qshurick / pro_log
此包最新版本(dev-master)没有可用的许可信息。
日志记录器
dev-master
2014-06-29 19:02 UTC
Requires (Dev)
- phpunit/phpunit: 3.7.*
- zendframework/zendframework1: 1.12.x
Suggests
- zendframework/zendframework1: This only works with Zend Framework 1.x
This package is not auto-updated.
Last update: 2024-09-28 15:08:24 UTC
README
在 application.ini 中确保
autoloaderNamespaces[] = "Logger_"
pluginPaths.Logger_Application_Resource_ = "Logger/Application/Resource"
config.logger = APPLICATION_PATH "/configs/log.ini"
在 include_path
目录 'vendor/qshurick/pro_log/library'
中确保,例如在 public_html/index.php
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
realpath(APPLICATION_PATH . '/../vendor/qshurick/pro_log/library'),
get_include_path(),
)));
require_once APPLICATION_PATH . '/../vendor/autoload.php';
使用方法
- 与 Zend_Registry 一起使用
// Logger_Application_Logger Zend_Registry::get('logger')->log('Log message');
- 直接
// Logger_Application_Logger Logger_Application_Logger::getInstance()->log('Log message');
- 嵌入
class SomeLoggedClass { /** ... */ function init() { /** ... */ // Zend_Log $this->logger = Zend_Registry::get('logger')->ensureStream('custom-logger'); $this->logger->log('Log message', Zend_Log::INFO); /** ... */ } /** ... */ }
已弃用(仅用于当前兼容性)
Pro_Log::log('Log message');