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; }); }
$gettext->setOptions(['compileAlways' => $compileAlways, 'locale' => $locale->getBestLocale(), 'supported' => $locale->getSupportedLocales(), 'domains' => $config->locale->domains, 'localeDir' => $config->path->localeDir, 'localeCacheDir' => $config->path->localeCacheDir]); return $gettext; }); /** * */ $di->setShared('debug', function () use($di) { $config = $di->getConfig(); $logger = new MultipleStreamLogger(); switch (ENV) { case DEV_ENV: $logger->push(new ErrorLogger()); if ('cli' != php_sapi_name()) { $debugLogFile = str_replace('{{name}}', $config->site->domains[0], $config->dev->path->debugLog); $fileLogger = new FileLogger($debugLogFile); $fileLogger->getFormatter()->setFormat('%message%'); $logger->push($fileLogger); $logger->push(new Firelogger()); $logger->push(new FirephpLogger('')); } break; } return $logger; }); /** * Mail service */ $di->setShared('mailer', function () use($di) { $config = $di->get('config'); $mailManager = new MailManager($config->mailer, $config->site->mail); $mailManager->setDI($di);
public function getFormatter() { return parent::getFormatter(); }