Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * 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();
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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();
 }
Exemplo n.º 5
0
 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}");
 }
Exemplo n.º 6
0
 /**
  * コンストラクタ
  *
  * @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);
 }
Exemplo n.º 7
0
Arquivo: Log.php Projeto: shupp/openid
 /**
  * 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;
 }
Exemplo n.º 8
0
 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);
 }
Exemplo n.º 9
0
 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];
 }
Exemplo n.º 10
0
 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);
 }
Exemplo n.º 11
0
 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);
 }
Exemplo n.º 12
0
 /**
  * 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;
 }
Exemplo n.º 13
0
 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");
 }
Exemplo n.º 14
0
	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;
	}
Exemplo n.º 15
0
 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;
     }
 }
Exemplo n.º 16
0
 /**
  * Given a setting from the config file and a logger type, add the appropriate
  * PEAR logger object and associated verbosity settings to our $logMethods
  * array if logging should be enabled using this logging method.
  *
  * @access private
  * @param   string  $configString   The line from config.ini.
  * @param   string  $loggerType     The type of PEAR Log object to create.
  * @param   array   $config         Extra settings for Log factory method.
  */
 private function addLogger($configString, $loggerType, $config = array())
 {
     if ($configString) {
         // Construct the log object:
         list($name, $levels) = explode(':', $configString);
         $ident = 'vufind';
         $logger = Log::factory($loggerType, $name, $ident, $config);
         // Only add the object to our array if it exists and at least one level
         // of logging was specified:
         $levels = $this->parseLevels($levels);
         if ($levels['mask'] != PEAR_LOG_NONE && $logger) {
             // Set a mask to only log message types requested by the user:
             $logger->setMask($levels['mask']);
             // Store the logger object and verbosity information:
             $this->logMethods[] = array('logger' => $logger, 'verbosity' => $levels['verbosity']);
         }
     }
 }
Exemplo n.º 17
0
 public function testAttachLog()
 {
     foreach (explode(':', get_include_path()) as $path) {
         if (file_exists($path . '/Log.php')) {
             include_once 'Log.php';
         }
     }
     if (!class_exists('Log')) {
         $this->markTestSkipped();
     }
     $log = Log::factory('null');
     HTTP_OAuth::attachLog($log);
     $oauth = $this->getMock('HTTP_OAuth', array('foo'));
     $oauth->debug('foo');
     $oauth->info('foo');
     $oauth->err('foo');
     HTTP_OAuth::detachLog($log);
 }
Exemplo n.º 18
0
 public function NotifyProcess($data, &$msg)
 {
     $log = Log::factory(NT_LOGS_PATH . 'wxpay_saoma/');
     $log->write('wxpay_saoma_notify', "call back:\n" . json_encode($data) . "\n");
     $notfiyOutput = array();
     if (!array_key_exists("transaction_id", $data)) {
         $msg = "输入参数不正确";
         $log->write('wxpay_saoma_notify_transaction_id', "输入参数不正确\n" . json_encode($data) . "\n");
         return false;
     }
     //查询订单,判断订单真实性
     if (!$this->Queryorder($data["transaction_id"])) {
         $msg = "订单查询失败";
         $log->write('wxpay_saoma_notify_Queryorder', "订单" . $data['out_trade_no'] . "查询失败\n" . json_encode($data) . "\n");
         return false;
     }
     /******************************查询订单正确后start*****************************************/
     //把订单中的支付改为微信支付
     $order_sn = $data['out_trade_no'];
     $order_info = OrderInfo::get_by_sn($order_sn);
     if ($order_info) {
         //检查支付钱数是否被修改过
         $total_fee = $data["total_fee"] / 100;
         $money_paid = $order_info['order_money'] + $order_info['shipping_fee'] - $order_info['bonus'];
         if ($total_fee != $money_paid) {
             $log->write('wxpay_saoma_money', "支付钱数对不上, 订单号为:" . $order_info . ", 微信返回总钱数" . $total_fee . "!=订单总钱数" . $money_paid . "\n" . json_encode($data) . "\n" . json_encode($order_info) . "\n");
             return false;
         }
         //支付成功,改变支付状态为yes
         $order_id = $order_info['order_id'];
         if ($order_info['pay_status'] == 'no') {
             $order = new OrderInfo($order_id);
             $modify = $order->wxsaoma_pay_status();
             $log->write('wxpay_saoma_changepay', $modify);
             $log->write('wxpay_saoma_success', "【支付成功】:\n" . json_encode($data) . "\n" . json_encode($order_info) . "\n");
         }
     } else {
         $log->write('wxpay_saoma_not_exists_order', "订单" . $order_sn . "不存在\n" . json_encode($data) . "\n");
         return false;
     }
     /******************************查询订单正确后end*****************************************/
     return true;
 }
Exemplo n.º 19
0
 public function run($options)
 {
     $consoleConf = array('lineFormat' => '[%1$s] %4$s');
     $logfileConf = array('append' => false, 'lineFormat' => '%4$s');
     $this->_console = Log::factory('console', '', '', $consoleConf, PEAR_LOG_INFO);
     if (count($options) < 2) {
         $this->_console->log('Missing parameter: no file to import.');
         return;
     }
     $logfilePath = 'reject.log';
     if (count($options) > 2) {
         // logfile path is given
         $logfilePath = $options[2];
     }
     $this->_logfile = Log::factory('file', $logfilePath, '', $logfileConf, PEAR_LOG_INFO);
     $xmlFile = $options[1];
     $importer = new Opus_Util_MetadataImport($xmlFile, true, $this->_console, $this->_logfile);
     $importer->run();
 }
Exemplo n.º 20
0
 public function deleteKeys($job)
 {
     $data = unserialize($job->workload());
     Log::factory()->write(Log::NOTICE, "Try to delete: {$data['key']} at {$data['server']['host']}:{$data['server']['port']}, DB: {$data['server']['database']}", 'Gearman');
     $db = Db::factory($data['server']);
     $db->changeDB($data['server']['database']);
     $keys = $db->keys($data['key']);
     $count = count($keys);
     if ($count) {
         $db->set("phpredmin:gearman:deletecount:{$data['key']}", $count);
         $db->del("phpredmin:gearman:deleted:{$data['key']}");
         $db->del("phpredmin:gearman:requests:{$data['key']}");
         foreach ($keys as $key) {
             if ($db->delete($key) !== false) {
                 $db->incrBy("phpredmin:gearman:deleted:{$data['key']}", 1);
                 $db->expireAt("phpredmin:gearman:deleted:{$data['key']}", strtotime('+10 minutes'));
             } else {
                 Log::factory()->write(Log::INFO, "Unable to delete {$key}", 'Gearman');
             }
         }
         $db->del("phpredmin:gearman:deletecount:{$data['key']}");
     }
 }
Exemplo n.º 21
0
 function FAlbum()
 {
     require_once FALBUM_PATH . '/lib/Log.php';
     // Init Lang
     include_once FALBUM_PATH . '/falbum-lang.php';
     //
     $this->has_error = false;
     $this->error_detail = null;
     $this->options = $this->get_options();
     $this->can_edit = $this->_can_edit();
     $this->show_private = $this->_show_private();
     $this->_construct_template($this->options['style']);
     $conf = array('title' => 'FAlbum Log Output');
     if ($this->can_edit == true) {
         //this->logger = & Log :: factory('fwin', 'LogWindow', '', $conf);
         //$this->logger = & Log :: factory('display', 'LogWindow', '', $conf);
         $this->logger =& Log::factory('null', 'LogWindow');
     } else {
         //$this->logger = & Log :: factory('fwin', 'LogWindow', '', $conf);
         $this->logger =& Log::factory('null', 'LogWindow');
     }
     //$mask = Log::UPTO(PEAR_LOG_INFO);
     //$this->logger->setMask($mask);
 }
Exemplo n.º 22
0
 /**
  * Attempts to return a reference to a concrete Log instance of type
  * $handler, only creating a new instance if no log instance with the same
  * parameters currently exists.
  *
  * You should use this if there are multiple places you might create a
  * logger, you don't want to create multiple loggers, and you don't want to
  * check for the existance of one each time. The singleton pattern does all
  * the checking work for you.
  *
  * <b>You MUST call this method with the $var = &Log::singleton() syntax.
  * Without the ampersand (&) in front of the method name, you will not get
  * a reference, you will get a copy.</b>
  *
  * @param string $handler   The type of concrete Log subclass to return.
  *                          Attempt to dynamically include the code for
  *                          this subclass. Currently, valid values are
  *                          'console', 'syslog', 'sql', 'file', and 'mcal'.
  *
  * @param string $name      The name of the actually log file, table, or
  *                          other specific store to use.  Defaults to an
  *                          empty string, with which the subclass will
  *                          attempt to do something intelligent.
  *
  * @param string $ident     The identity reported to the log system.
  *
  * @param array $conf       A hash containing any additional configuration
  *                          information that a subclass might need.
  *
  * @param int $level        Log messages up to and including this level.
  *
  * @return object Log       The newly created concrete Log instance, or
  *                          null on an error.
  * @access public
  * @since Log 1.0
  */
 function &singleton($handler, $name = '', $ident = '', $conf = array(), $level = PEAR_LOG_DEBUG)
 {
     static $instances;
     if (!isset($instances)) {
         $instances = array();
     }
     $signature = serialize(array($handler, $name, $ident, $conf, $level));
     if (!isset($instances[$signature])) {
         $instances[$signature] =& Log::factory($handler, $name, $ident, $conf, $level);
     }
     return $instances[$signature];
 }
Exemplo n.º 23
0
 /**
  * Write events to the logfile.
  *
  * It does some additional work, like time measuring etc. to
  * see some additional info
  *
  * @param string $text log message
  *
  * @return void
  * @access public
  */
 function writeLog($text = 'START')
 {
     //it's still really a quicky.... 'refactor' (nice word) that
     if (!isset($this->options['logfile'])) {
         return;
     }
     include_once 'Log.php';
     if (!class_exists('Log')) {
         return;
     }
     if (!$this->_logObject) {
         $this->_logObject =& Log::factory('file', $this->options['logfile']);
     }
     if ($text === 'start query' || $text === 'end query') {
         $bytesSent = $this->db->queryAll("SHOW STATUS like 'Bytes_sent'");
         $bytesSent = $bytesSent[0]['Value'];
     }
     if ($text === 'START') {
         $startTime = split(' ', microtime());
         $this->_logData['startTime'] = $startTime[1] + $startTime[0];
     }
     if ($text === 'start query') {
         $this->_logData['startBytesSent'] = $bytesSent;
         $startTime = split(' ', microtime());
         $this->_logData['startQueryTime'] = $startTime[1] + $startTime[0];
         return;
     }
     if ($text === 'end query') {
         $text .= ' result size: ' . ((int) $bytesSent - (int) $this->_logData['startBytesSent']) . ' bytes';
         $endTime = split(' ', microtime());
         $endTime = $endTime[1] + $endTime[0];
         $text .= ', took: ' . ($endTime - $this->_logData['startQueryTime']) . ' seconds';
     }
     if (strpos($text, 'query built') === 0) {
         $endTime = split(' ', microtime());
         $endTime = $endTime[1] + $endTime[0];
         $this->writeLog('query building took: ' . ($endTime - $this->_logData['startTime']) . ' seconds');
     }
     $this->_logObject->log($text);
     if (strpos($text, 'end query') === 0) {
         $endTime = split(' ', microtime());
         $endTime = $endTime[1] + $endTime[0];
         $text = 'time over all: ' . ($endTime - $this->_logData['startTime']) . ' seconds';
         $this->_logObject->log($text);
     }
 }
Exemplo n.º 24
0
 /**
  * Determines if loading of PEAR::Log is necessary.
  *
  * If an object is passed it is returned, otherwise Log is loaded
  * and instantiated.
  *
  * @param  bool|Log Boolean that indicates if a log instance
  *                  should be created or an instance of a class
  *                  that implements the PEAR:Log interface.
  * @return log instance of the given log class
  *
  * @access protected
  */
 function &PEARLogFactory(&$log)
 {
     if (empty($log) || is_object($log)) {
         return $log;
     }
     require_once 'Log.php';
     $log =& Log::factory('composite');
     if (!is_a($log, 'Log_composite')) {
         $this->stack->push(LIVEUSER_ERROR_CONFIG, 'exception', array(), 'Could not create Log instance');
         $return = false;
         return $return;
     }
     $conf = array('colors' => array(PEAR_LOG_EMERG => 'red', PEAR_LOG_ALERT => 'orange', PEAR_LOG_CRIT => 'yellowgreen', PEAR_LOG_ERR => 'green', PEAR_LOG_WARNING => 'blue', PEAR_LOG_NOTICE => 'indigo', PEAR_LOG_INFO => 'violet', PEAR_LOG_DEBUG => 'black'));
     $winlog =& Log::factory('win', 'LiveUser', 'LiveUser', $conf);
     if (!is_a($winlog, 'Log_win')) {
         $this->stack->push(LIVEUSER_ERROR_CONFIG, 'exception', array(), 'Could not create Log "window" instance');
         $return = false;
         return $return;
     }
     $log->addChild($winlog);
     return $log;
 }
Exemplo n.º 25
0
//    Copyright (C) 2006-2008 Malcolm Cowe
//    Copyright (C) 2010-2011 Uwe Steinmann
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include "[[softpath]]/LetoDMS_Core/Log/Log.php";
if ($settings->_logFileEnable) {
    if ($settings->_logFileRotation == "h") {
        $logname = date("YmdH", time());
    } else {
        if ($settings->_logFileRotation == "d") {
            $logname = date("Ymd", time());
        } else {
            $logname = date("Ym", time());
        }
    }
    $logger = Log::factory('file', $settings->_contentDir . $logname . '.log');
} else {
    $logger = null;
}
Exemplo n.º 26
0
 /**
  * This method lazy loads PEAR::Log.
  *
  * @param  bool|object $log     Boolean that indicates if a log instance
  *                              should be created or an instance of a class
  *                              that implements the PEAR:Log interface.
  * @return void
  *
  * @access protected
  */
 function &PEARLogFactory(&$log)
 {
     if (!is_object($log)) {
         require_once 'Log.php';
         $log =& Log::factory('composite');
         $conf = array('colors' => array(PEAR_LOG_EMERG => 'red', PEAR_LOG_ALERT => 'orange', PEAR_LOG_CRIT => 'yellowgreen', PEAR_LOG_ERR => 'green', PEAR_LOG_WARNING => 'blue', PEAR_LOG_NOTICE => 'indigo', PEAR_LOG_INFO => 'violet', PEAR_LOG_DEBUG => 'black'));
         $winlog =& Log::factory('win', 'LiveUser', 'LiveUser', $conf);
         $log->addChild($winlog);
     }
     return $log;
 }
Exemplo n.º 27
0
 /**
  * @param string $type      The type of concrete Log subclass to use.
  *                          Currently, valid values are 'console',
  *                          'syslog', 'sql', 'file', and 'mcal'.
  * @param string $name      The name of the actually log file, table, or
  *                          other specific store to use. Defaults to an
  *                          empty string, with which the subclass will
  *                          attempt to do something intelligent.
  * @param string $ident     The identity reported to the log system.
  * @param array  $conf      A hash containing any additional configuration
  *                          information that a subclass might need.
  * @param int $maxLevel     Maximum priority level at which to log.
  */
 public function __construct($type, $name = '', $ident = '', $conf = array(), $maxLevel = PEAR_LOG_DEBUG)
 {
     if (PHPUnit_Util_Filesystem::fileExistsInIncludePath('Log.php')) {
         PHPUnit_Util_Filesystem::collectStart();
         require_once 'Log.php';
         $this->log = Log::factory($type, $name, $ident, $conf, $maxLevel);
         foreach (PHPUnit_Util_Filesystem::collectEnd() as $blacklistedFile) {
             PHPUnit_Util_Filter::addFileToFilter($blacklistedFile, 'PHPUNIT');
         }
     } else {
         throw new RuntimeException('Log is not available.');
     }
 }
Exemplo n.º 28
0
 /**
  * @param string $type      The type of concrete Log subclass to use.
  *                          Currently, valid values are 'console',
  *                          'syslog', 'sql', 'file', and 'mcal'.
  * @param string $name      The name of the actually log file, table, or
  *                          other specific store to use. Defaults to an
  *                          empty string, with which the subclass will
  *                          attempt to do something intelligent.
  * @param string $ident     The identity reported to the log system.
  * @param array  $conf      A hash containing any additional configuration
  *                          information that a subclass might need.
  * @param int $maxLevel     Maximum priority level at which to log.
  * @access public
  */
 public function __construct($type, $name = '', $ident = '', $conf = array(), $maxLevel = PEAR_LOG_DEBUG)
 {
     $this->log = Log::factory($type, $name, $ident, $conf, $maxLevel);
 }
Exemplo n.º 29
0
 /**
  * Start the log for debug
  * @param    string  filename
  * @param    int     debug level. See {@link Log}
  */
 public function startLog($sFile = 'php_beautifier.log', $iLevel = PEAR_LOG_DEBUG)
 {
     @unlink($sFile);
     $oLogFile = Log::factory('file', $sFile, 'php_beautifier', array(), PEAR_LOG_DEBUG);
     $this->oLog->addChild($oLogFile);
 }
Exemplo n.º 30
0
 /**
  * 	作用:post请求xml
  */
 function postXml()
 {
     $log = Log::factory(NT_LOGS_PATH . 'wxpay_tongyi/');
     $xml = $this->createXml();
     $log->write('wxpay_tongyi', array('requestxml' => $xml));
     // logger::write('wxpay_tongyi', array('requestxml'=>$xml));
     $this->response = $this->postXmlCurl($xml, $this->url, $this->curl_timeout);
     $log->write('wxpay_tongyi', array('returnxml' => $this->response));
     // logger::write('wxpay_tongyi', array('returnxml'=>$this->response));
     return $this->response;
 }