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');