Analog PHP
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);
?>
评论
