cruxoft/logbook

Monolog的Registry交互的简单包装器

0.1.3 2018-07-13 09:57 UTC

This package is auto-updated.

Last update: 2024-09-26 23:30:18 UTC


README

这是什么?

这是一个Monolog的Registry系统交互的简单包装器,允许旧系统从现代日志记录中受益。

对于具有多个通道和处理器的更复杂Monolog设置,更好的解决方案是Monolog Cascade

安装

可以通过运行以下命令使用composer安装

$ composer require cruxoft/logbook

用法

Logbook的简单但常见用法如下

use Cruxoft\Logbook;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;

// Generate one or more handlers
$handler = new StreamHandler("./sample.log", Logger::ERROR);

// Add a log channel with specified handlers, optional processors can also be added
Logbook::add("my_log_channel", array($handler));

// Raising a log, standard monolog methods can be used eg. error() err(), addError()
Logbook::get("my_log_channel")->error("This is just an example");