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


PHP Zend_Log::__construct方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $writer = new Log_Writer_Console();
     parent::__construct($writer);
     $enable = Zend_Registry::get("configuration")->log->enable;
     $this->setEnable($enable);
 }
开发者ID:ubriela,项目名称:solr-websearch,代码行数:7,代码来源:Log.php

示例2: __construct

 /**
  * Class constructor. Create a new logger.
  *
  * @param Streamwide_Log_Writer_Abstract $writer (optional) Default writer.
  */
 public function __construct($writer = null)
 {
     parent::__construct($writer);
     $this->_priorities[Zend_Log::ERR] = 'ERROR';
     $this->_priorities[Zend_Log::WARN] = 'WARNING';
     $this->_start = $this->_last = $this->_getmicrotime();
     $this->_memMin = $this->_memMax = memory_get_usage();
 }
开发者ID:cwcw,项目名称:cms,代码行数:13,代码来源:Log.php

示例3: __construct

 /**
  * Class constructor.  Create a new logger
  *
  * @param Zend_Log_Writer_Abstract|null  $writer  default writer
  * @return void
  */
 public function __construct(Zend_Log_Writer_Abstract $writer = null)
 {
     parent::__construct($writer);
     if ($pid = getmypid()) {
         $this->stamp = 'p' . $pid;
     } else {
         $this->stamp = substr(md5($_SERVER['REQUEST_TIME'] . rand(0, 100)), 0, 7);
     }
 }
开发者ID:kalburgimanjunath,项目名称:system,代码行数:15,代码来源:Log.php

示例4:

 function __construct($logToFileFilename, $fileFormatter, $screenFormatter, $logToDatabaseTableName, $logToDatabaseColumnMapping)
 {
     parent::__construct();
     $this->logToFileFilename = Zend_Registry::get('config')->path->log . $logToFileFilename;
     $this->fileFormatter = $fileFormatter;
     $this->screenFormatter = $screenFormatter;
     $this->logToDatabaseTableName = Piwik::prefixTable($logToDatabaseTableName);
     $this->logToDatabaseColumnMapping = $logToDatabaseColumnMapping;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:9,代码来源:Log.php

示例5:

 function __construct($logToFileFilename, $fileFormatter, $screenFormatter, $logToDatabaseTableName, $logToDatabaseColumnMapping)
 {
     parent::__construct();
     $this->logToFileFilename = PIWIK_INCLUDE_PATH . '/' . Zend_Registry::get('config')->log->logger_file_path . $logToFileFilename;
     $this->fileFormatter = $fileFormatter;
     $this->screenFormatter = $screenFormatter;
     $this->logToDatabaseTableName = Piwik::prefixTable($logToDatabaseTableName);
     $this->logToDatabaseColumnMapping = $logToDatabaseColumnMapping;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:9,代码来源:Log.php

示例6: __construct

 public function __construct($logFilename = null, $description = null, $logDirectory = null)
 {
     // If no directory entered, user the default log folder
     if ($logDirectory === null) {
         $logDirectory = realpath(PUBLIC_PATH . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR;
     } else {
         $logDirectory = realpath($logDirectory) . DIRECTORY_SEPARATOR;
     }
     if ($logDirectory !== false) {
         // If no filename entered, create a new name
         $this->_filename = $logFilename;
         if ($logFilename === null) {
             $this->_filename = 'log';
         }
         $currentDate = new Zend_Date();
         // Get the microtime
         $microtime = microtime();
         $microtime = str_replace('.', '', $microtime);
         $microtime = str_replace(' ', '', $microtime);
         // Prepend the current date and time to the filename
         $this->_filename = $currentDate->toString('yyyy-MM-dd-HH-mm-ss') . '_' . $microtime . '_' . $this->_filename;
         // Build the complete filename (including the complete path)
         $this->_filename = $logDirectory . $this->_filename . '.txt';
         // If the log file allready exists, try to create a unique filename by
         // appending a number to the filename
         $i = 1;
         while (is_file($this->_filename) && $i < 100) {
             $this->_filename = $logDirectory . '_' . $i . '.txt';
             $i++;
         }
         // If it is not possible to create a unique filename, throw an error
         if (is_file($this->_filename)) {
             throw new Zend_Controller_Action_Exception('Cannot create the log file. The log file allready exists.');
         }
         // Add a stream writer to the log object
         $logWriter = new Zend_Log_Writer_Stream($this->_filename);
         // Construct the parent log object
         parent::__construct($logWriter);
         // Set the timestamp format in the log
         $this->setTimestampFormat('Y-m-d H:i:s');
         // Calculate the start time
         $mtime = microtime();
         $mtime = explode(' ', $mtime);
         $mtime = $mtime[1] + $mtime[0];
         $this->_startTime = $mtime;
         $currentDate = new Zend_Date();
         // Write the import header to the log
         $this->log('------------------------------------', 6);
         if ($description !== null) {
             $this->log(' Description: ' . $description, 6);
         }
         $this->log(' Log File: ' . $this->_filename, 6);
         $this->log(' Start: ' . $currentDate->toString('yyyy-MM-dd HH:mm:ss:S'), 6);
         $this->log('------------------------------------', 6);
     }
 }
开发者ID:hausdesign,项目名称:zf-library,代码行数:56,代码来源:Log.php

示例7: __construct

 public function __construct()
 {
     // set formatter, disini ditambahkan %class% untuk informasi
     // log message dihasilkan dari class mana
     $format = '%timestamp% (%priorityName%) %priority% %class%: %message%' . PHP_EOL;
     $this->_formatter = new Zend_Log_Formatter_Simple($format);
     parent::addWriter($this->_errorWriter());
     parent::addWriter($this->_allWriter());
     parent::__construct();
 }
开发者ID:hukumonline,项目名称:pmg,代码行数:10,代码来源:Log.php

示例8: __construct

 /**
  * Constructor, we added some interesting info to log
  */
 public function __construct(Zend_Log_Writer_Abstract $writer = null)
 {
     if ($this->debugLevel > 0) {
         $writer = new Zend_Log_Writer_Mock();
     } else {
         $writer = new Zend_Log_Writer_Null();
     }
     parent::__construct($writer);
     $this->initNewProps();
     if ($this->debugLevel >= 2) {
         $this->addFirebugWriter();
     }
 }
开发者ID:Cryde,项目名称:sydney-core,代码行数:16,代码来源:Log.php

示例9:

 function __construct($logToFileFilename, $fileFormatter, $screenFormatter, $logToDatabaseTableName, $logToDatabaseColumnMapping)
 {
     parent::__construct();
     $log_dir = Zend_Registry::get('config')->log->logger_file_path;
     if ($log_dir[0] != '/' && $log_dir[0] != DIRECTORY_SEPARATOR) {
         $log_dir = PIWIK_USER_PATH . '/' . $log_dir;
     }
     $this->logToFileFilename = $log_dir . '/' . $logToFileFilename;
     $this->fileFormatter = $fileFormatter;
     $this->screenFormatter = $screenFormatter;
     $this->logToDatabaseTableName = Piwik::prefixTable($logToDatabaseTableName);
     $this->logToDatabaseColumnMapping = $logToDatabaseColumnMapping;
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:13,代码来源:Log.php

示例10: substr

 function __construct($logToFileFilename, $fileFormatter, $screenFormatter, $logToDatabaseTableName, $logToDatabaseColumnMapping)
 {
     parent::__construct();
     $this->currentRequestKey = substr(Piwik_Common::generateUniqId(), 0, 8);
     $log_dir = Piwik_Config::getInstance()->log['logger_file_path'];
     if ($log_dir[0] != '/' && $log_dir[0] != DIRECTORY_SEPARATOR) {
         $log_dir = PIWIK_USER_PATH . '/' . $log_dir;
     }
     $this->logToFileFilename = $log_dir . '/' . $logToFileFilename;
     $this->fileFormatter = $fileFormatter;
     $this->screenFormatter = $screenFormatter;
     $this->logToDatabaseTableName = Piwik_Common::prefixTable($logToDatabaseTableName);
     $this->logToDatabaseColumnMapping = $logToDatabaseColumnMapping;
 }
开发者ID:nnnnathann,项目名称:piwik,代码行数:14,代码来源:Log.php

示例11: __construct

 /**
  * Cunstructor takes a Zend_Log_Writer_Db instance
  * 
  * @param Zend_Log_Writer_Db $writer
  * @param string $projectName
  * @param bool   $registerMonitor
  */
 public function __construct(Zend_Log_Writer_Abstract $writer, $projectName = NULL, $registerMonitor = TRUE)
 {
     parent::__construct($writer);
     if (defined('APPLICATION_ENV')) {
         $this->environment = APPLICATION_ENV;
     }
     if (isset($projectName)) {
         $this->projectName = (string) $projectName;
     }
     if (TRUE == $registerMonitor) {
         //Register the monitor for application wide usage
         Zend_Registry::set('monitor', $this);
     }
 }
开发者ID:riteshsahu1981,项目名称:Weadvance,代码行数:21,代码来源:Monitor.php

示例12: __construct

 /**
  * Constructor function.
  *
  * For all the defined filenames for log constant,
  * will create a Zend_Log object
  * with the path to the filename and a filter for these log.
  *
  * @param Zend_Config $config Object contain the user configuration.
  *
  * @return void
  */
 public function __construct(Zend_Config $config)
 {
     parent::__construct();
     $this->_loggers = array();
     if (isset($config->log)) {
         foreach ($config->log as $key => $val) {
             $constant = "self::" . strtoupper($key);
             if (defined($constant)) {
                 $priority = constant($constant);
                 $logger = new Zend_Log(new Zend_Log_Writer_Stream($val->filename));
                 $logger->addFilter(new Zend_Log_Filter_Priority($priority));
                 $this->_loggers[] = $logger;
             }
         }
     }
 }
开发者ID:joerch,项目名称:PHProjekt,代码行数:27,代码来源:Log.php

示例13: __construct

 /**
  * @return void
  */
 public function __construct()
 {
     parent::__construct(new Zend_Log_Writer_Db(Zend_Controller_Front::getInstance()->getParam('bootstrap')->getResource('multidb')->getDb('log'), 'log.sms', array('smsid' => 'smsId', 'errorcode' => 'errorCode', 'errormessage' => 'errorMessage')));
 }
开发者ID:knatorski,项目名称:SMS,代码行数:7,代码来源:Log.php

示例14: __construct

 /**
  * Class constructor.  Create a new logger
  *
  * @param Zend_Log_Writer_Abstract|null  $writer  default writer
  */
 public function __construct(Zend_Log_Writer_Abstract $writer = null)
 {
     parent::__construct($writer);
     $this->_flippedPriorities = array_flip($this->_priorities);
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:10,代码来源:Log.php

示例15: __construct

 /**
  * Construct a logger with filename depending on $logRotate
  *
  * @param mixed $filename Start of the filename minus .log extension
  * @param mixed $logRotate One of the cosntants for log rotate
  * @param int One of the \Zend_Log constants
  */
 public function __construct($filename, $logRotate = null, $priority = null)
 {
     $this->_logFileRoot = $filename;
     $this->_logRotate = $logRotate;
     $this->_logFileName = $this->_getLogFileName();
     // Empty the file if it is on rotation after a year
     $this->_checkLogOverwrite();
     try {
         $writer = new \Zend_Log_Writer_Stream($this->_logFileName);
     } catch (\Exception $exc) {
         try {
             // Try to solve the problem, otherwise fail heroically
             \MUtil_File::ensureDir(dirname($this->_logFileName));
             $writer = new \Zend_Log_Writer_Stream($this->_logFileName);
         } catch (\Exception $exc) {
             $this->bootstrap(array('locale', 'translate'));
             die(sprintf($this->translate->_('Path %s not writable'), dirname($this->_logFileName)));
         }
     }
     parent::__construct($writer);
     if (null !== $priority) {
         $this->setLogPriority($priority);
     }
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:31,代码来源:Log.php


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