当前位置: 首页>>代码示例>>PHP>>正文


PHP CakeLog::getInstance方法代码示例

本文整理汇总了PHP中CakeLog::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeLog::getInstance方法的具体用法?PHP CakeLog::getInstance怎么用?PHP CakeLog::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CakeLog的用法示例。


在下文中一共展示了CakeLog::getInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: write

 /**
  * Writes the given message and type to all of the configured log adapters.
  * Configured adapters are passed both the $type and $message variables. $type
  * is one of the following strings/values.
  *
  * ### Types:
  *
  * - `LOG_WARNING` => 'warning',
  * - `LOG_NOTICE` => 'notice',
  * - `LOG_INFO` => 'info',
  * - `LOG_DEBUG` => 'debug',
  * - `LOG_ERR` => 'error',
  * - `LOG_ERROR` => 'error'
  *
  * ### Usage:
  *
  * Write a message to the 'warning' log:
  *
  * `CakeLog::write('warning', 'Stuff is broken here');`
  *
  * @param string $type
  *        	Type of message being written
  * @param string $message
  *        	Message content to log
  * @return boolean Success
  * @access public
  * @static
  *
  */
 function write($type, $message)
 {
     if (!defined('LOG_ERROR')) {
         define('LOG_ERROR', 2);
     }
     if (!defined('LOG_ERR')) {
         define('LOG_ERR', LOG_ERROR);
     }
     $levels = array(LOG_WARNING => 'warning', LOG_NOTICE => 'notice', LOG_INFO => 'info', LOG_DEBUG => 'debug', LOG_ERR => 'error', LOG_ERROR => 'error');
     if (is_int($type) && isset($levels[$type])) {
         $type = $levels[$type];
     }
     $self =& CakeLog::getInstance();
     if (empty($self->_streams)) {
         $self->_autoConfig();
     }
     $keys = array_keys($self->_streams);
     foreach ($keys as $key) {
         $logger =& $self->_streams[$key];
         $logger->write($type, $message);
     }
     return true;
 }
开发者ID:arendasistemasintegrados,项目名称:mateusleme,代码行数:52,代码来源:cake_log.php

示例2: write

 /**
  * Writes the given message and type to all of the configured log adapters.
  * Configured adapters are passed both the $type and $message variables. $type
  * is one of the following strings/values.
  *
  * ### Types:
  *
  * - `LOG_WARNING` => 'warning',
  * - `LOG_NOTICE` => 'notice',
  * - `LOG_INFO` => 'info',
  * - `LOG_DEBUG` => 'debug',
  * - `LOG_ERR` => 'error',
  * - `LOG_ERROR` => 'error'
  *
  * ### Usage:
  *
  * Write a message to the 'warning' log:
  * 
  * `CakeLog::write('warning', 'Stuff is broken here');`
  *
  * @param string $type Type of message being written
  * @param string $message Message content to log
  * @return boolean Success
  * @access public
  * @static
  */
 function write($type, $message)
 {
     if (!defined('LOG_ERROR')) {
         define('LOG_ERROR', 2);
     }
     if (!defined('LOG_ERR')) {
         define('LOG_ERR', LOG_ERROR);
     }
     if (Configure::read('Database_log') === true) {
         $settings = array('class' => 'SystemLog', 'alias' => 'SystemLog', 'table' => 'system_logs', 'ds' => 'default');
         ClassRegistry::init($settings);
         $SystemLogModel =& ClassRegistry::getObject('SystemLog');
     }
     $levels = array(LOG_WARNING => 'warning', LOG_NOTICE => 'notice', LOG_INFO => 'info', LOG_DEBUG => 'debug', LOG_ERR => 'error', LOG_ERROR => 'error');
     if (is_int($type) && isset($levels[$type])) {
         $type = $levels[$type];
     }
     $self =& CakeLog::getInstance();
     if (empty($self->_streams)) {
         $self->_autoConfig();
     }
     $keys = array_keys($self->_streams);
     foreach ($keys as $key) {
         $logger =& $self->_streams[$key];
         $logger->write($type, $message);
         if (isset($SystemLogModel) && !empty($SystemLogModel)) {
             $SystemLog_data = array('id' => 0, 'type' => $type, 'log_text' => $message);
             $SystemLogModel->save($SystemLog_data);
         }
     }
     return true;
 }
开发者ID:hobbysh,项目名称:seevia-frameworks,代码行数:58,代码来源:cake_log.php


注:本文中的CakeLog::getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。