📃 A multi-module log wrapper.
- PHP >= 7.0
$ composer require "overtrue/cuttle"
use Overtrue\Cuttle\Cuttle;
$config = [
'default' => 'foo', // default channel
'formatters' => [
'dashed' => [
'formatter' => \Monolog\Formatter\LineFormatter::class, // default
'format' => "%datetime% - %channel%.%level_name% - %message%\n"
],
],
'handlers' => [
'file' => [
'handler' => \Monolog\Handler\StreamHandler::class, // default
'formatter' => 'dashed',
'stream' => '/tmp/demo.log',
'level' => 'info',
],
'console' => [
'formatter' => 'dashed',
'stream' => 'php://stdout',
'level' => 'debug',
],
],
'channels' => [
'foo' => [
'handlers' => ['console', 'file'],
],
'bar' => [
'handlers' => ['file'],
],
],
];
$cuttle = new Cuttle($config);
$cuttle->info('hello'); // channel: foo
$cuttle->channel('bar')->debug('debug message.');
// aslias of channel($name)
// ->of('bar')
// ->from('bar')
想知道如何从零开始构建 PHP 扩展包?
请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— 《PHP 扩展包实战教程 - 从入门到发布》
MIT