vakata/log

文件日志类

3.0.2 2016-10-27 11:39 UTC

This package is auto-updated.

Last update: 2024-09-10 06:04:05 UTC


README

Latest Version on Packagist Software License Build Status Code Climate Tests Coverage

文件日志类。

安装

通过 Composer

$ composer require vakata/log

使用方法

// create an instance
// by default all error levels are logged to the default "error_log" location
$log = new \vakata\log\Log();
// log a message with some params
$log->debug('Just some info', ['context'=>'params']);
// add some additional context for all future calls
$log->addContext(['context'=>'for all future logs']);
// directly logging exceptions works too
try {
    throw new Exception('Some exception');
}
catch (\Exception $e) {
    $log->error($e);
}

// you can optionally make sure only certain error levels are logged
// and also specify a file for the log
$log = new \vakata\log\Log(
    \vakata\log\Log::ALL ^ \vakata\log\Log::DEBUG, // we log everything but debug
    __DIR__ . '/path/to.log'
);

API 文档 中阅读更多。

测试

$ composer test

贡献

请参阅 CONTRIBUTING 获取详细信息。

安全

如果您发现任何与安全相关的问题,请通过电子邮件 github@vakata.com 而不是使用问题跟踪器。

致谢

许可

MIT 许可证 (MIT)。有关更多信息,请参阅 许可文件