monolog使用

安装composer

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

 composer require monolog/monolog

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
require __DIR__.'/vendor/autoload.php';

use Monolog\Logger;
use Monolog\Handler\StreamHandler;

// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('test.log', Logger::WARNING));
 
// add records to the log
$log->addWarning('Foo');
$log->addError('Bar');

  

 



posted @ 2017-02-04 17:30  brady-wang  阅读(2202)  评论(0编辑  收藏  举报