PHP 日志包 Analog PHP
fmms
13年前
<p>Analog PHP 是一个简单的 PHP 日志包,要求 PHP 5.3+,具备可配置和可扩展性。</p> <ul> <li>Buffer - Buffer messages to send all at once (works with Mail handler)</li> <li>File - Append messages to a file</li> <li>FirePHP - Send messages to <a href="/misc/goto?guid=4958339026023469990">FirePHP</a> browser plugin</li> <li>LevelBuffer - Buffer messages and send only if sufficient error level reached</li> <li>Mail - Send email notices</li> <li>Mongo - Save to MongoDB collection</li> <li>Multi - Send different log levels to different handlers</li> <li>Null - Do nothing</li> <li>Post - Send messages over HTTP POST to another machine</li> <li>Stderr - Send messages to STDERR</li> <li>Syslog - Send messages to syslog</li> <li>Variable - Buffer messages to a variable reference.</li> </ul> <p>示例代码:</p> <pre class="brush:php; toolbar: true; auto-links: false;"><?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); ?></pre> <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1326163963015" target="_blank">http://www.open-open.com/lib/view/home/1326163963015</a></p> <p></p>