PHP 日志包 Analog PHP
<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>
本文由用户 fmms 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!