示例#1
0
 public function __construct()
 {
     $writer = new Log_Writer_Console();
     parent::__construct($writer);
     $enable = Zend_Registry::get("configuration")->log->enable;
     $this->setEnable($enable);
 }
示例#2
0
文件: Log.php 项目: cwcw/cms
 /**
  * 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();
 }
示例#3
0
 /**
  * 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);
     }
 }
示例#4
0
文件: Log.php 项目: Doluci/tomatocart
 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;
 }
示例#5
0
 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;
 }
示例#6
0
 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);
     }
 }
示例#7
0
文件: Log.php 项目: hukumonline/pmg
 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();
 }
示例#8
0
文件: Log.php 项目: Cryde/sydney-core
 /**
  * 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();
     }
 }
示例#9
0
文件: Log.php 项目: Doluci/tomatocart
 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;
 }
示例#10
0
文件: Log.php 项目: nnnnathann/piwik
 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;
 }
示例#11
0
 /**
  * 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);
     }
 }
示例#12
0
文件: Log.php 项目: joerch/PHProjekt
 /**
  * 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;
             }
         }
     }
 }
示例#13
0
文件: Log.php 项目: knatorski/SMS
 /**
  * @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')));
 }
 /**
  * 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);
 }
示例#15
0
文件: Log.php 项目: GemsTracker/MUtil
 /**
  * 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);
     }
 }
示例#16
0
文件: Monitor.php 项目: rexmac/zyndax
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct()
 {
     parent::__construct(new DoctrineLogWriter());
 }
示例#17
0
 public function __construct(Zend_Log_Writer_Abstract $writer = null)
 {
     parent::__construct($writer);
 }
示例#18
0
 /**
  * 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->_initDefaultWriter($writer));
     $pid = bin2hex(openssl_random_pseudo_bytes(5));
     $this->setEventItem('pid', $pid);
 }
示例#19
0
 public function __construct(DebugLogUploader $debugLogUploader, \Zend_Log_Writer_Abstract $writer = null)
 {
     parent::__construct($writer);
     $this->setDebugLogUploader($debugLogUploader);
 }
示例#20
0
 public function __construct($logger = null)
 {
     parent::__construct();
     $this->logger = $logger;
 }
示例#21
0
 public function __construct()
 {
     $writer = new Kwf_Log_Writer_Stream(APP_PATH . '/eventlog', 'w');
     $writer->setFormatter(new Zend_Log_Formatter_Simple('%message%' . PHP_EOL));
     parent::__construct($writer);
 }
示例#22
0
 public function __construct($displayError = false)
 {
     $this->_defaultPriority = Zend_Log::DEBUG;
     $this->_displayError = $displayError;
     parent::__construct(new Zend_Log_Writer_Firebug());
 }
示例#23
0
 public function __construct($pName)
 {
     $pName = strtolower($pName);
     $this->set_name($pName);
     parent::__construct($this->get_stream());
 }