本文整理汇总了PHP中Kohana_Log::config方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana_Log::config方法的具体用法?PHP Kohana_Log::config怎么用?PHP Kohana_Log::config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kohana_Log
的用法示例。
在下文中一共展示了Kohana_Log::config方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
/**
* Add a new message to the log.
*
* @param string type of message
* @param string message text
* @return void
*/
public static function add($type, $message)
{
// Make sure the drivers and config are loaded
if (!is_array(Kohana_Log::$config)) {
Kohana_Log::$config = Kohana::config('log');
}
if (!is_array(Kohana_Log::$drivers)) {
foreach ((array) Kohana::config('log.drivers') as $driver_name) {
// Set driver name
$driver = 'Log_' . ucfirst($driver_name) . '_Driver';
// Load the driver
if (!Kohana::auto_load($driver)) {
throw new Kohana_Exception('Log Driver Not Found: %driver%', array('%driver%' => $driver));
}
// Initialize the driver
$driver = new $driver(array_merge(Kohana::config('log'), Kohana::config('log_' . $driver_name)));
// Validate the driver
if (!$driver instanceof Log_Driver) {
throw new Kohana_Exception('%driver% does not implement the Log_Driver interface', array('%driver%' => $driver));
}
Kohana_Log::$drivers[] = $driver;
}
// Always save logs on shutdown
Event::add('system.shutdown', array('Kohana_Log', 'save'));
}
Kohana_Log::$messages[] = array('date' => time(), 'type' => $type, 'message' => $message);
}