overtrue/cuttle

This package is abandoned and no longer maintained. No replacement package was suggested.

A multi-module log wrapper.

0.0.2 2017-07-07 09:54 UTC

This package is auto-updated.

Last update: 2020-09-06 11:41:06 UTC


README

📃 A multi-module log wrapper.

Build Status Latest Stable Version Latest Unstable Version Scrutinizer Code Quality Code Coverage Total Downloads License

Requirements

  • PHP >= 7.0

Installing

$ composer require "overtrue/cuttle"

Usage

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 扩展包?

请关注我的实战课程,我会在此课程中分享一些扩展开发经验 —— 《PHP 扩展包实战教程 - 从入门到发布》

License

MIT