本文整理汇总了PHP中Object::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::log方法的具体用法?PHP Object::log怎么用?PHP Object::log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::log方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
/**
*
* Log messages (debugging purpose)
* @param string $msg
* @param int $type (default 2)
* @return <boolean/string>
*/
public function log($msg, $type = 2)
{
if (class_exists('Object')) {
!$this->_Object instanceof Object && ($this->_Object = new Object());
return $this->_Object->log($msg, $type);
}
return false;
}
示例2: process
public static function process($exception)
{
if (class_exists('TransactionManager')) {
TransactionManager::rollback();
}
$params = array('class' => $class = get_class($exception), 'message' => $exception->getMessage(), 'file' => str_replace(ROOT, 'ROOT', $exception->getFile()), 'line' => $exception->getLine(), 'trace' => $exception->getTraceAsString());
$textError = self::_text($params);
if (Configure::read('debug') == 0) {
Object::log($textError);
switch (true) {
case $class === 'DatabaseError':
return Object::cakeError('error503', array(array('code' => 503, 'name' => 'Service Unavailable', 'message' => '')));
case isset($exception->httpCode):
$error = $exception->httpCode === 403 ? 'forbidden' : 'error' . $exception->httpCode;
return Object::cakeError($error);
}
return Object::cakeError('error500', array(array('code' => 500, 'name' => 'An Internal Error Has Occurred', 'message' => '')));
} else {
if (php_sapi_name() == 'cli') {
echo $textError;
} else {
header('Content-Type: text/html; charset=UTF-8');
echo self::_html($params);
}
}
}
示例3: logIt
/**
* This method writes messages in a log file.
* @param String $msg A message to write.
* @return Worker
*/
public function logIt($msg)
{
if (!is_null($this->logger)) {
$this->logger->log(LogLevel::INFO, $msg);
}
return $this;
}
示例4: _dispatchService
protected function _dispatchService($callback, $params, $options = array())
{
$options += array('catchTry' => $this->catchTry, 'logException' => $this->logException);
$this->begin();
if ($options['catchTry']) {
try {
$result = call_user_func_array($callback, $params);
} catch (Exception $e) {
if ($options['logException']) {
Object::log($e->__toString());
}
$result = false;
}
} else {
$result = call_user_func_array($callback, $params);
}
if (!$result) {
$this->rollback();
} else {
$this->commit();
}
return $result;
}
示例5: direct
/**
* This method is called automatically when using the name of the helper directly
*
* @param string $message
* @param string $debugLevel
* @return void
*/
public function direct($message, $debugLevel = Zend_Log::INFO)
{
$this->logger->log($message, $debugLevel);
}
示例6: log
function log($msg, $type = LOG_ERROR)
{
if (!empty($this->config['nick'])) {
$type = $this->config['nick'];
} else {
$type = 'error';
}
parent::log($msg, $type);
}
示例7: log
/**
* log method
*
* Record to the log (the head doc block on first load in debug mode) or output the log (call with no params)
*
* @param mixed $string
* @static
* @return logs contents if requested, otherwise null
* @access public
*/
public static function log($string = null, $shellObject = null)
{
if (self::$start === null) {
self::$start = microtime(true);
}
static $log = array();
if ($shellObject) {
self::$__Shell =& $shellObject;
}
if ($string === null) {
$settings = self::$settings;
ksort($settings);
foreach ($settings as $k => &$v) {
$v = ' ' . str_pad($k, 15, ' ', STR_PAD_RIGHT) . "\t: " . $v;
}
$settings[] = '';
$head = array_merge(array('MiCompressor log - (only generated on first load) ' . date("D, M jS Y, H:i:s"), null), $settings);
$log = array_merge($head, $log);
$return = "/**\r\n * " . implode("\r\n * ", $log) . "\r\n */\r\n";
$log = array();
self::$start = microtime(true);
return $return;
}
if (strpos($string, 'PROBLEM') !== false && class_exists('Object')) {
$Object = new Object();
$Object->log($string, 'mi_compressor');
}
$time = microtime(true) - self::$start;
$msg = str_pad(number_format($time, 3, '.', ''), 6, ' ', STR_PAD_LEFT) . 's ' . $string;
if (!empty(self::$__Shell)) {
self::$__Shell->out($msg);
}
$log[] = $msg;
}