public function __construct() { $this->config = core_config(); if (is_null(static::$logger)) { static::$logger = new Logger('ingest'); $logname = core_config('logs.path') . DS . 'activity.log'; static::$logger->pushHandler(new StreamHandler($logname, Logger::DEBUG)); } if (is_null(static::$manager)) { if (core_config()->has('default.local') && core_config()->has('staging.local')) { $default = new Local(core_config('default.local')); $staging = new Local(core_config('staging.local')); $public = new Local(core_config('public.local')); $defaultIfc = new Filesystem($default); $stagingIfc = new Filesystem($staging); $publicIfc = new Filesystem($public); } else { print "The system is not fully configured: default.local and staging.local must both be set.\n"; return false; } static::$manager = new MountManager(['default' => $defaultIfc, 'staging' => $stagingIfc, 'public' => $publicIfc]); static::$logger->addInfo(__CLASS__ . '::' . __FUNCTION__ . ': ========= MARK: INIT ========='); } if (is_null(static::$disk)) { $this->initDiskMap(); } }
protected function getSQLLogger() { if (!isset(static::$logger)) { static::$logger = new DebugStack(); } return static::$logger; }
public static function getLogger() { if (static::$logger) { return static::$logger; } return static::$logger = new static(); }
static function set_logger($logger) { if (!is_callable($logger)) { return false; } static::$logger = $logger; return true; }
/** * @param string $logFile * @param bool $logDebug * * @throws \RuntimeException */ public function __construct($logFile, $logDebug = false) { if (static::$logger instanceof MainLogger) { throw new \RuntimeException("MainLogger has been already created"); } static::$logger = $this; $this->logStream = \ThreadedFactory::create(); $this->start(); }
private static function init() { if (static::$logger === null) { $config = Kernel::getConfig('log', array('class' => 'PFinal\\Wechat\\Support\\Logger')); $class = $config['class']; unset($config['class']); static::$logger = new $class($config); } }
function __construct($login = null, $password = null, $options = array()) { $this->login = $login; $this->password = $password; if ($options) { $this->setOptions($options); } static::$logger = Logger::getLogger(__CLASS__); }
/** * WPLogger constructor. * インスタンスの初期化 */ private function __construct() { static::$path = get_template_directory() . '/logs/debug.log'; static::$logger = new Logger('wptheme'); $output = "[%datetime%] %level_name%: %message% %context% %extra%\n"; $formatter = new LineFormatter($output); $stream = new StreamHandler(static::$path, Logger::DEBUG); $stream->setFormatter($formatter); static::$logger->pushHandler($stream); }
/** * @return Logger */ public static function getLogger() { if (!static::$logger) { static::$logger = new Logger(static::$logDirectory, static::$email, static::getBlueScreen()); static::$logger->directory =& Tracy\Debugger::$logDirectory; // back compatiblity static::$logger->email =& Tracy\Debugger::$email; Tracy\Debugger::setLogger(static::$logger); } return Tracy\Debugger::getLogger(); }
public static function build(array $data) { $obj = new static($data); if (!$obj->logger()) { throw new \InvalidArgumentException("logger may not be empty"); } if (!$obj->m()) { throw new \InvalidArgumentException("mapperBuilder may not be empty"); } return $obj; }
/** * @param string $logFile * @param bool $logDebug * * @throws \RuntimeException */ public function __construct($logFile, $logDebug = false) { if (static::$logger instanceof MainLogger) { throw new \RuntimeException("MainLogger has been already created"); } static::$logger = $this; touch($logFile); $this->logFile = $logFile; $this->logDebug = (bool) $logDebug; $this->logStream = new \Threaded(); $this->start(); }
/** * @param null $object * @param $level * @param $message * @param array $context * @return null */ public static function log($object = null, $level, $message, $context = []) { if (is_object($object)) { $className = get_class($object); $pid = getmypid(); $message = "[{$className} {$pid}] {$message}"; } if (static::$logger == null) { static::$logger = new ConsoleLogger(); } return static::$logger->log($level, $message, $context); }
/** * @param string $logFile * @param bool $logDebug * * @throws \RuntimeException */ public function __construct($logFile, $logDebug = false) { if (static::$logger instanceof MainLogger) { throw new \RuntimeException("MainLogger has been already created"); } static::$logger = $this; $this->enabled = false; file_put_contents($logFile, "", FILE_APPEND); $this->logFile = $logFile; $this->logDebug = (bool) $logDebug; $this->logStream = new \Threaded(); $this->start(); }
/** * @param string $logFile * @param bool $hasANSI * @param bool $logDebug * * @throws \RuntimeException */ public function __construct($logFile, $hasANSI = false, $logDebug = false) { if (static::$logger instanceof MainLogger) { throw new \RuntimeException("MainLogger has been already created"); } static::$logger = $this; \touch($logFile); $this->logFile = $logFile; $this->hasANSI = (bool) $hasANSI; $this->logDebug = (bool) $logDebug; $this->logStream = ""; $this->start(PTHREADS_INHERIT_NONE); }
/** * @return Esendex_Sms_Model_Logger_Logger */ public static function getInstance() { if (static::$logger) { return static::$logger; } $file = sprintf('%s/%s', Mage::getBaseDir('log'), static::LOG_FILE); $logger = new Zend_Log(new Zend_Log_Writer_Stream($file)); if (!Mage::getStoreConfig('esendex_sms/sms/debug_mode')) { $logger->addFilter(new Zend_Log_Filter_Priority(Zend_Log::CRIT)); } static::$logger = new Esendex_Sms_Model_Logger_Logger($logger); return static::$logger; }
/** * Get the logger currently in use, or create a new one if it doesn't exist. * * @return object */ public static function get_logger() { if (!static::$logger) { // Create default logger static::$logger = new static::$logger_class(); // Add default context (shouldn't change until the actual log event happens) foreach (static::$log_globals as $globalName => $keys) { foreach ($keys as $key) { $val = isset($GLOBALS[$globalName][$key]) ? $GLOBALS[$globalName][$key] : null; static::$logger->setEventItem(sprintf('$%s[\'%s\']', $globalName, $key), $val); } } } return static::$logger; }
/** * @param string $logFile * @param bool $logDebug * * @throws \RuntimeException */ public function __construct($logFile, $logDebug = false, $write = true) { if (static::$logger instanceof MainLogger) { throw new \RuntimeException("MainLogger has been already created"); } static::$logger = $this; $this->write = $write; if ($write) { touch($logFile); $this->logFile = $logFile; $this->logDebug = (bool) $logDebug; } $this->logStream = \ThreadedFactory::create(); $this->start(); }
public static function register(Di $di) { static::$hostname = gethostname(); $di->remove('log'); static::$logger = null; $di->setShared('log', function () { $filePath = storagePath('logs'); is_dir($filePath) or mkdir($filePath, 0777, true); $filePath .= '/' . Config::get('app.log.file', 'phwoolcon.log'); $logger = new File($filePath); $formatter = $logger->getFormatter(); if ($formatter instanceof Line) { $formatter->setDateFormat('Y-m-d H:i:s'); $formatter->setFormat('[%date%]{host}[%type%] {request} %message%'); } return $logger; }); }
/** * @param null|AdapterOptions $adapterName * @param array $options * @throws Exception\RuntimeException * @return Acl */ public static function getInstance($adapterName = null, $options = array()) { if (static::$instance === null) { static::$logger = Logger::getLogger(__CLASS__); if ($adapterName instanceof AdapterInterface) { $adapter = $adapterName; } else { $adapter = static::getAdapterManager()->get($adapterName); } if ($options) { $adapter->setOptions($options); } static::$instance = new self($adapter); } elseif ($adapterName !== null && static::$instance->getOptions()->getThrowRuntimeExceptions()) { static::$logger->error("Acl cannot be initialized twice."); throw new RuntimeException("Acl cannot be initialized twice."); } return static::$instance; }
/** * Handle dynamic, static calls to the object. * inspired by Laravel's Illuminate/Support/Facades/Facade.php */ public static function __callStatic($method, $args) { if (!isset(static::$logger)) { static::$logger = new Logger(); } $logger = static::$logger; switch (count($args)) { case 0: return $logger->{$method}(); case 1: return $logger->{$method}($args[0]); case 2: return $logger->{$method}($args[0], $args[1]); case 3: return $logger->{$method}($args[0], $args[1], $args[2]); case 4: return $logger->{$method}($args[0], $args[1], $args[2], $args[3]); default: return call_user_func_array([$logger, $method], $args); } }
public static function initLogger($name = "enjine", $dir = "/var/log") { if (!is_dir($dir)) { throw new \ErrorException("Logs path does not exist!"); } static::$logger = new Logger($name); static::$logsDir = $dir; $handlers = []; $formatter = new LineFormatter("%datetime%: %level_name% :: %message% | %context% | %extra%\n", "D M j Y, g:i A"); foreach (static::$LOG_LEVELS as $label => $level) { static::$logFile = static::$logsDir . DIRECTORY_SEPARATOR . "{$label}.log"; if (!file_exists(static::$logFile)) { $d = pathinfo(static::$logFile)["dirname"]; if (!is_dir($d)) { mkdir($d, 0664, true); } touch(static::$logFile); } $handlers[$label] = new StreamHandler(static::$logFile, $level); $handlers[$label]->setFormatter($formatter); static::$logger->pushHandler($handlers[$label]); } return static::$logger; }
public function __construct($options = array()) { static::$logger = Logger::getLogger(get_class($this)); $this->setOptions($options); }
public static function init($name, $handler) { static::$logger = new MonologLogger($name); static::$logger->pushHandler($handler); }
private static function setLogger() { static::$logger = new Logger('curl'); }
/** * @return \Psr\Log\LoggerInterface */ protected function getLogger() { if (null === static::$logger) { static::$logger = static::getProducer()->getLogger(); } return static::$logger; }
/** * @param LogInterface $logger */ public static function setLogger(LogInterface $logger) { static::$logger = $logger; }
/** * Sets a logger instance on the object * * @param \Psr\Log\LoggerInterface $logger PSR-3 compatible logger object * * @return null */ public static function setLogger($logger) { static::$logger = $logger; }
public static function setLogger(LoggerInterface $logger) { static::$logger = $logger; return self; }
public static function setupBeforeClass() { parent::setupBeforeClass(); FacebookSession::setDefaultApplication(static::$appId, static::$appSecret); static::$session = new FacebookSession(static::$accessToken); static::$logger = new NullLogger(); }