Analog PHP 1.0 稳定版发布了,该版本增加了 PSR-0 的可选支持;增加自动 PHPUnit 配置;增加文件、标准错误的缓冲输出;通过 PHP 的 class_alias() 函数加速了非 PSR-0 模式;改善了文档和示例;另外 Analog 现在已经可通过 Composer/Packaglist.org 包管理器获取。
Analog PHP 是一个简单的 PHP 日志包,要求 PHP 5.3+,具备可配置和可扩展性。示例代码请看。
示例代码:
<?php require_once ('Analog.php'); // Default logging to /tmp/analog.txt Analog::log ('Log this error'); // Log to a MongoDB log collection Analog::handler (function ($info) { static $conn = null; if (! $conn) { $conn = new Mongo ('localhost:27017'); } $conn->mydb->log->insert ($info); }); // Log an alert Analog::log ('The sky is falling!', Analog::ALERT); // Log some debug info Analog::log ('Debugging info', Analog::DEBUG); ?>
Analog PHP下载地址请点这里
