当前位置: 首页>>代码示例>>PHP>>正文


PHP Log::factory方法代码示例

本文整理汇总了PHP中Log::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::factory方法的具体用法?PHP Log::factory怎么用?PHP Log::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Log的用法示例。


在下文中一共展示了Log::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: log

 /**
  * function description
  *
  * @param
  * @return void
  */
 public static function log($message, $priority, $path = '')
 {
     $log_level = defined('LOG_LEVEL') ? LOG_LEVEL : self::L_ERR;
     if ($priority > $log_level) {
         return false;
     }
     if (defined('_PS_DEBUG') && TRUE === _PS_DEBUG && PHP_SAPI !== 'cli') {
         self::$_logs[] = $priority . ' ' . var_export($message, true);
     }
     $now = time();
     static $logger = null;
     if ($logger === null) {
         static $conf = null;
         if ($conf === null) {
             $log_root = defined('LOG_ROOT') ? LOG_ROOT : '/tmp/';
             $log_root = $path ? $log_root . $path . '/' : $log_root;
             $conf = array('lineFormat' => '%1$s %2$s: [%3$s] %4$s', 'destination' => $log_root . 'sp_' . PHP_SAPI . '_' . date('oW', $now) . '.log');
         }
         $name = defined('LOG_NAME') ? LOG_NAME : 'SP';
         $logger =& Log::factory('error_log', self::TYPE_FILE, $name, $conf);
     }
     if (is_object($logger)) {
         $logger->setMask(Log::MAX(LOG_LEVEL));
         if (!is_string($message)) {
             $message = var_export($message, true);
         }
         $message .= "\n";
         return $logger->log($message, $priority);
     }
     return false;
 }
开发者ID:ahmatjan,项目名称:Scene-Editor-for-mobile,代码行数:37,代码来源:Log.php

示例2: __construct

 /**
  * Reescribo la constructora para evitar todo lo que tiene que ver con Sesion y DB
  */
 function __construct()
 {
     $tilePathName = 'Admin';
     $this->_skinConfig = Configuracion::getTemplateConfigByDir($skinName);
     //@deprecated ya no se usa el calendario js, se prefiere el uso de jQuery
     $this->_calendar = new FCEcalendar('/js/jscalendar/', "es", "../../skins/" . $this->_skinConfig['dir'] . "/css/cal", false);
     //si se puede cargo el usuario
     $this->getUsuario();
     $this->_dateFormat = Configuracion::getDateFormat();
     $this->_dateTimeFormat = Configuracion::getDateTimeFormat();
     $this->_timeFormat = Configuracion::getTimeFormat();
     $this->pasquinoPath = Configuracion::getPasquinoPath();
     $this->initSmarty();
     $this->_orderListado = $_SESSION[get_class($this)]['sort'];
     $this->_sentidoOrderListado = $_SESSION[get_class($this)]['sortSentido'];
     if (method_exists($this->smarty, 'getTemplateVars')) {
         $this->_tilePath = $this->smarty->getTemplateVars('pQnDefaultTpl');
     } else {
         $this->_tilePath = Configuracion::getDefaultTplPath($skinName);
     }
     //'decorators/default.tpl';
     //seteo el path de donde está pasquino
     if (Configuracion::getLoggerClass() != null) {
         $this->logger = Log::factory(Configuracion::getLoggerClass());
     }
     $tConf = Configuracion::getTemplateConfigByNombre($skinName);
     $this->_tilePath = Configuracion::findTplPath($tConf, $tilePathName);
     if (!isset($this->_tilePath) && method_exists($this->smarty, 'getTemplateVars')) {
         //smarty3 y el tilePath está vacio
         $this->_tilePath = $this->smarty->getTemplateVars('pQn' . $tilePathName . 'Tpl');
     }
     $this->initListColumns();
 }
开发者ID:asivas,项目名称:pasquino-tools,代码行数:36,代码来源:BaseToolsMod.class.php

示例3: __construct

 public function __construct($config)
 {
     $this->_objects['app'] = App::instance();
     $this->_objects['router'] = Router::instance();
     $this->_objects['inputs'] = Inputs::instance();
     $this->_objects['session'] = Session::instance();
     $this->_objects['log'] = Log::factory();
     if (!isset($this->app->config['database']['redis'][$config['serverId']])) {
         $config['serverId'] = 0;
     }
     $current = $this->app->config['database']['redis'][$config['serverId']];
     $current['serverId'] = $config['serverId'];
     $this->_objects['db'] = Db::factory($current);
     $this->_objects['infoModel'] = new Info_Model($current);
     $info = $this->db->info();
     $dbs = $this->infoModel->getDbs($info);
     if (!isset($current['max_databases'])) {
         $databasesConfig = $this->_objects['db']->config('GET', 'databases');
         $current['max_databases'] = $databasesConfig['databases'];
     }
     // Take care of invalid dbId's. If invalid, set to first available database
     if (!is_numeric($config['dbId']) || $config['dbId'] < 0 || $config['dbId'] >= $current['max_databases']) {
         $config['dbId'] = $dbs[0];
     }
     $current['newDB'] = !in_array($config['dbId'], $dbs) ? true : false;
     $current['database'] = $config['dbId'];
     // Extract number of keys
     foreach ($dbs as $i) {
         if (preg_match('/^keys=([0-9]+),expires=([0-9]+)/', $info["db{$i}"], $matches)) {
             $current['dbs'][$i] = array('id' => $i, 'keys' => $matches[1], 'name' => isset($current['dbNames'][$i]) ? $current['dbNames'][$i] : null);
         }
     }
     $this->db->select($current['database']);
     $this->app->current = $current;
 }
开发者ID:BlackIkeEagle,项目名称:phpredmin,代码行数:35,代码来源:controller.php

示例4: __construct

 public function __construct($config)
 {
     $this->_objects['app'] = App::instance();
     $this->_objects['router'] = Router::instance();
     $this->_objects['session'] = Session::instance();
     $this->_objects['db'] = Db::factory($config);
     $this->_objects['log'] = Log::factory();
 }
开发者ID:xxoxx,项目名称:phpredmin,代码行数:8,代码来源:model.php

示例5: errorHandler

 public function errorHandler($no, $str, $file, $line, $context)
 {
     if (!(error_reporting() & $no)) {
         // This error code is not included in error_reporting
         return;
     }
     $type = self::_getError($no);
     Log::factory()->write($type, "{$str} on {$file}:{$line}");
 }
开发者ID:xxoxx,项目名称:phpredmin,代码行数:9,代码来源:error.php

示例6: LogMassage

 /**
  * コンストラクタ
  *
  * @access   public
  * @author  M.Ozeki
  * @version $Id: IRJDisplayCommon_cls.php, v 1.0 2008/04/01 14:00 Exp $
  * @copyright
  */
 function LogMassage()
 {
     //
     $this->_iLevel = IRJ_LOG_LEVEL;
     // ログファイル保存先
     $sTitle = date("Ymd");
     $sFilePath = COMMON_DOCUMENT_ROOT . 'log/' . $sTitle . "_log";
     $aConf = array('append' => 1, 'timeFormat' => '%X %x', 'locking' => 1, 'mode' => 0777, 'eol' => "\n");
     $this->_oLogObj = Log::factory('file', $sFilePath, $this->_sIndent, $aConf, $this->_iLevel);
 }
开发者ID:BigBin,项目名称:web_crawler,代码行数:18,代码来源:LogMessage_cls.php

示例7: __construct

 /**
  * Allows you to pass in a Log instance and an array of events to log.  If
  * no instance of Log is given, the 'file' Log driver will be used, and write to
  * /tmp/OpenID_Observer_Log.log.
  * 
  * @param Log   $log    Instance of Log, optional
  * @param array $events Custom list of events to log
  * 
  * @return void
  */
 public function __construct(Log $log = null, array $events = array())
 {
     if (count($events)) {
         $this->setEvents($events);
     }
     if (!$log instanceof Log) {
         $log = Log::factory('file', '/tmp/' . __CLASS__ . '.log');
     }
     $this->log = $log;
 }
开发者ID:shupp,项目名称:openid,代码行数:20,代码来源:Log.php

示例8: setUp

 public function setUp()
 {
     $this->log_file = "/tmp/log_file.test";
     // delete $log_file...
     if (file_exists($this->log_file)) {
         unlink($this->log_file);
     }
     $this->logger = Log::factory('file', $this->log_file, 'AdvancedDVDLibrary');
     $mask = Log::UPTO(PEAR_LOG_DEBUG);
     $this->logger->setMask($mask);
 }
开发者ID:ahiliation,项目名称:beautifulwork,代码行数:11,代码来源:LogTest.php

示例9: get_instance

 public static function get_instance($handler = 'file', $name = '')
 {
     if (self::$instances == null) {
         self::$instances = array();
     }
     $sum = md5($handler . $name);
     if (empty(self::$instances[$sum])) {
         self::$instances[$sum] = Log::factory($handler, $name);
     }
     return self::$instances[$sum];
 }
开发者ID:JackSpratt,项目名称:silk,代码行数:11,代码来源:class.silk_logger.php

示例10: log

 public static function log($msg, $log_level = PEAR_LOG_WARNING)
 {
     if (!self::$logger) {
         self::$logger = Log::factory('file', self::$LOG_FILE_PATH);
         self::$logger->setPriority(self::$LOG_PRIORITY);
         //            self::$output_logger = Log::factory('console');
     }
     if ($log_level <= self::$LOG_PRIORITY) {
         self::$logger->log($msg, $log_level);
     }
     //        self::$output_logger->log($msg, $log_level);
 }
开发者ID:qbert65536,项目名称:phillips-head,代码行数:12,代码来源:Logger.php

示例11: report_error

 private function report_error($msg, $output)
 {
     $logger = Log::factory('syslog', LOG_LOCAL0, 'lyx2rfc');
     $logger->log('Error reported: ' . $msg);
     echo "<title>Lyx2RFC Error</title>";
     echo "<p style='color:red; font-weight:bold; font-size:200%'>" . $msg . "</p>";
     if ($output) {
         echo "<hr><pre>";
         echo join("\n", $output);
         echo "</pre>";
     }
     exit(1);
 }
开发者ID:runt18,项目名称:lyx2rfc,代码行数:13,代码来源:convert.php

示例12: main

 /**
  * Applies action
  *
  * @return  boolean success
  */
 protected function main()
 {
     $logging = $this->params['logging'];
     if ($logging === 0 || !$logging) {
         return true;
     }
     $lfile = $this->params['lfile'];
     $code = $this->params['code'];
     $log_msg = $this->params['log_msg'];
     require_once 'Log.php';
     $file =& Log::factory('file', $lfile, $code);
     $file->log($log_msg);
     return true;
 }
开发者ID:savonix,项目名称:nexista,代码行数:19,代码来源:log.action.php

示例13: setUp

 public function setUp()
 {
     self::$verificationErrors = array();
     $this->screenshot_number = 1;
     // screenshot overhead; coupled with php overhead...
     $_inter_one = get_class($this);
     $_inter_two = explode('\\', $_inter_one);
     $this->current_class_name = end($_inter_two);
     $this->prep_screenshot_dirs();
     $this->log = \Log::factory('file', $this->current_test_log_dir . DIRECTORY_SEPARATOR . 'test.log');
     if ($GLOBALS['settings']['sauce.ondemand']) {
         $server_host = $GLOBALS['saucelabs']['username'] . ":" . $GLOBALS['saucelabs']['key'] . "@ondemand.saucelabs.com";
         $profile_path = null;
         if (array_key_exists('profile-' . strtolower(PHP_OS), $GLOBALS['settings'])) {
             $profile_path = $GLOBALS['settings']['saunter.base'] . DIRECTORY_SEPARATOR . 'support/profiles/' . $GLOBALS['saucelabs']['profile-' . strtolower(PHP_OS)];
         } elseif (array_key_exists('profile', $GLOBALS['settings'])) {
             $profile_path = $GLOBALS['settings']['saunter.base'] . DIRECTORY_SEPARATOR . 'support/profiles/' . $GLOBALS['settings']['profile'];
         }
         if ($profile_path) {
             if (is_dir($profile_path)) {
                 $hosted_path = $GLOBALS['settings']['fileserver'] . '/profiles/' . basename($profile_path) . '.zip';
                 $zip = new \ZipArchive();
                 if ($zip->open($profile_path . '.zip', \ZipArchive::OVERWRITE) !== true) {
                     throw new \SaunterPHP_Framework_Exception("Unable to create profile zip {$profile_path}");
                 }
                 $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($profile_path, $flags = \FilesystemIterator::KEY_AS_PATHNAME | \FilesystemIterator::CURRENT_AS_FILEINFO | \FilesystemIterator::SKIP_DOTS));
                 foreach ($iterator as $key => $value) {
                     $zip->addFile($key, substr($key, strlen($profile_path) + 1)) or die("ERROR: Could not add file: {$key}");
                 }
                 $zip->close();
                 $decoded = json_decode($GLOBALS['settings']['browser'], $assoc = true);
                 $decoded['firefox-profile-url'] = $hosted_path;
                 $GLOBALS['settings']['browser'] = json_encode($decoded);
             } else {
                 throw new \SaunterPHP_Framework_Exception("Profile directory not found at {$profile_path}");
             }
         }
     } else {
         $server_host = $GLOBALS['settings']['seleniumserver'];
     }
     $server_port = $GLOBALS['settings']['seleniumport'];
     $this->driver = new \SaunterPHP_Framework_Bindings_SaunterRemoteControl($GLOBALS['settings']['browser'], $GLOBALS['settings']['webserver'], $server_host, $server_port);
     self::$selenium = $this->driver;
     $this->driver->start();
     $this->driver->windowMaximize();
     $this->sessionId = $this->driver->getEval("selenium.sessionId");
 }
开发者ID:PurdyForks,项目名称:saunter.php,代码行数:47,代码来源:RemoteControl.php

示例14: gets

	public function gets()
	{
		if (is_null($this->handle) || gzeof($this->handle))
		{
			return false;
		}

		$offset = $this->tell();
		$data = gzgets($this->handle);
		if ($data === false)
		{
			return false;
		}
		$data = Log::factory($data);
		$data->line_offset = $offset;
		return $data;
	}
开发者ID:rbroemeling,项目名称:logviewer,代码行数:17,代码来源:LogFile.class.php

示例15: parse

 protected function parse()
 {
     $this->method = $_SERVER['REQUEST_METHOD'];
     $this->protocol = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && $_SERVER['HTTPS'] !== 'off' || $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ? 'https' : 'http';
     $this->host = $_SERVER['HTTP_HOST'];
     $this->baseUrl = $this->protocol . '://' . $this->host;
     $this->url = $this->protocol . '://' . $this->host . $_SERVER['SCRIPT_NAME'];
     $this->path = '';
     if (PHP_SAPI != 'cli') {
         $this->path = str_replace($_SERVER['SCRIPT_NAME'], '', $_SERVER['REQUEST_URI']);
         Log::factory()->write(Log::INFO, $_SERVER['REQUEST_URI'], 'Router');
         if ($this->path == $_SERVER['REQUEST_URI']) {
             $this->path = '';
         }
     } elseif (isset($_SERVER['argv'][1])) {
         $this->path = $_SERVER['argv'][1];
     }
     $this->request = $this->url . $this->path;
     if (preg_match('/^(.*)\\/(.*)$/', $_SERVER['SCRIPT_NAME'], $matches)) {
         $this->baseUrl .= $matches[1];
     }
     if (preg_match('/^(.*)\\?(.*)$/', $this->path, $matches)) {
         $this->path = $matches[1];
         foreach (explode('&', $matches[2]) as $match) {
             if (preg_match('/^(.*)=(.*)$/', $match, $strings)) {
                 if ($strings[2]) {
                     $this->_query_strings[$strings[1]] = urldecode($strings[2]);
                 }
             }
         }
     }
     $this->_params = explode('/', trim($this->path, '/'));
     if (!($this->controller = ucwords(strtolower(array_shift($this->_params))))) {
         $this->controller = App::instance()->config['default_controller'];
     }
     if (!($this->action = array_shift($this->_params))) {
         $this->action = App::instance()->config['default_action'];
     }
     if (!($this->serverId = array_shift($this->_params))) {
         $this->serverId = 0;
     }
     if (!($this->dbId = array_shift($this->_params))) {
         $this->dbId = 0;
     }
 }
开发者ID:xxoxx,项目名称:phpredmin,代码行数:45,代码来源:router.php


注:本文中的Log::factory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。