本文整理汇总了PHP中Illuminate\Log\Writer::getMonolog方法的典型用法代码示例。如果您正苦于以下问题:PHP Writer::getMonolog方法的具体用法?PHP Writer::getMonolog怎么用?PHP Writer::getMonolog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Log\Writer
的用法示例。
在下文中一共展示了Writer::getMonolog方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
$correlationalId = $request->attributes->get(CorrelationalId::HEADER);
$this->logger->getMonolog()->pushProcessor(function ($record) use($correlationalId) {
$record['extra'][self::LOG_KEY] = $correlationalId;
return $record;
});
/** @var Response $response */
$response = $next($request);
return $response;
}
示例2: configureHandlers
/**
* Custom Monolog handler that for Logentries.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Log\Writer $log
* @return void
*/
protected function configureHandlers(Application $app, Writer $log)
{
$logger = $log->getMonolog();
$logfile_handler = new StreamHandler(storage_path() . '/logs/laravel.log');
$logger->pushHandler($logfile_handler);
$logger->pushProcessor(new \Monolog\Processor\MemoryUsageProcessor());
$logger->pushProcessor(new \Monolog\Processor\MemoryPeakUsageProcessor());
$logger->pushProcessor(new \Monolog\Processor\WebProcessor());
}
示例3: configureSeparateWriter
/**
* Configures log writer for logging to files separately from the application.
*
* @param Writer $writer
*/
protected function configureSeparateWriter(Writer $writer)
{
$path = 'logs/' . ltrim($this->getCore()->config('log.file', 'cms'), '/');
if ($this->getCore()->config('log.daily')) {
$writer->useDailyFiles(storage_path($path), (int) $this->getCore()->config('log.max_files'));
}
foreach ($writer->getMonolog()->getHandlers() as $handler) {
$handler->setLevel($this->getCore()->config('log.threshold'));
}
}
示例4: configureHandlers
/**
* Configure the Monolog handlers for the application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Log\Writer $log
* @return void
*/
protected function configureHandlers(Application $app, Writer $log)
{
// Stream handlers
$logPath = $app->storagePath() . '/logs/app.log';
$logLevel = Monolog::INFO;
$logStreamHandler = new StreamHandler($logPath, $logLevel);
// push handlers
$logger = $log->getMonolog();
$logger->pushHandler($logStreamHandler);
}
示例5: createLogger
/**
* Create the logger.
*
* @return \Illuminate\Log\Writer
*/
public function createLogger()
{
$log = new Writer(new Monolog($this->app->bound('env') ? $this->app->environment() : 'production'), $this->app['events']);
if ($this->app->hasMonologConfigurator()) {
call_user_func($this->app->getMonologConfigurator(), $log->getMonolog());
} else {
$this->configureHandlers($log);
}
return $log;
}
示例6: configureSingleHandler
/**
* Configure the Monolog handlers for the application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Log\Writer $log
* @return void
*/
protected function configureSingleHandler(Application $app, Writer $log)
{
$syslogHandler = new SyslogHandler(env('LOG_PREFIX', 'BasketLog'), LOG_USER, LOG_NOTICE);
$logger = $log->getMonolog();
if (env('LOG_SYSLOG', false)) {
$logger->pushHandler($syslogHandler);
}
if (env('LOG_FILE', false)) {
$streamHandler = new StreamHandler(storage_path('logs/laravel.log'), LOG_NOTICE);
$logger->pushHandler($streamHandler);
}
}
示例7: getMonolog
/**
* Get the underlying Monolog instance.
*
* @return \Monolog\Logger
* @static
*/
public static function getMonolog()
{
return \Illuminate\Log\Writer::getMonolog();
}
示例8: __construct
/**
* SendUpdateAvailableNotification constructor.
*
* @param Writer $logger
* @param Mailer $mailer
*/
public function __construct(Writer $logger, Mailer $mailer)
{
$this->logger = $logger->getMonolog();
$this->mailer = $mailer;
}
示例9: configureHandlers
/**
* OVERRIDE PARENT
* Configure the Monolog handlers for the application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Log\Writer $log
* @return void
*/
protected function configureHandlers(Application $app, Writer $log)
{
$log->getMonolog()->pushHandler(new ErrorLogHandler());
}
示例10: configureSeparateHandler
protected function configureSeparateHandler(Application $app, Writer $log)
{
$log->getMonolog()->pushHandler($handler = new SeparateFileHandler("dummy"));
$handler->setFormatter(new LineFormatter(null, null, true, true));
}