cherry-project/logger
Composer 安装命令:
composer require cherry-project/logger
包简介
Cherry-project logger
README 文档
README
The Cherry-project logger
Including
Install from composer composer require cherry-project/logger
Include Autoloader in your main file (Ex.: index.php)
require_once __DIR__ . '/vendor/autoload.php';
Import class
use Cherry\Logger;
Set logs directory
define('LOGS_DIR', __DIR__ . '/var/log');
Crete class new object
Logger class takes two arguments:
- Log Name, the logs filename {LogName}.log (Default 'app').
- Logs Directory(Default '/var/log').
$logger = new Logger('app-logs', LOGS_DIR);
Logger methods
The logger has 4 Log types:
- info();
- warning();
- error();
- debug()
and additional methods:
- clear() clear logs in current instance;
- count() get logs count in current instance;
Call methods
$logger->info('Info Message'); $logger->warning('Warning Message'); $logger->error('Error Message'); $logger->debug('Debug Message');
Also you can call more then one method from one object:
$logger->info('Info Message 2') ->warning('Warning Message 2') ->error('Error Message 2') ->debug('Debug Message 2');
If you need logs count in current instance, you might use count() method:
echo $logger->count();
You can clear all the logs in the current instance using the clear() method:
$logger->clear();
2019 © Cherry-project
统计信息
- 总下载量: 13
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-26