本文整理汇总了PHP中LoggerLog类的典型用法代码示例。如果您正苦于以下问题:PHP LoggerLog类的具体用法?PHP LoggerLog怎么用?PHP LoggerLog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LoggerLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: close
public function close()
{
$from = $this->from;
$to = $this->to;
if (!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) {
$subject = $this->subject;
LoggerLog::debug("LoggerAppenderMail::close() sending mail from=[{$from}] to=[{$to}] subject=[{$subject}]");
mail($to, $subject, $this->layout->getHeader() . $this->body . $this->layout->getFooter(), "From: {$from}\r\n");
}
$this->closed = true;
}
示例2: addRenderer
/**
* Add a renderer to a hierarchy passed as parameter.
* Note that hierarchy must implement getRendererMap() and setRenderer() methods.
*
* @param LoggerHierarchy $repository a logger repository.
* @param string $renderedClassName
* @param string $renderingClassName
* @static
*/
public static function addRenderer($repository, $renderedClassName, $renderingClassName)
{
LoggerLog::debug("LoggerRendererMap::addRenderer() Rendering class: [{$renderingClassName}], Rendered class: [{$renderedClassName}].");
$renderer = LoggerObjectRenderer::factory($renderingClassName);
if ($renderer == null) {
LoggerLog::warn("LoggerRendererMap::addRenderer() Could not instantiate renderer [{$renderingClassName}].");
return;
} else {
$repository->setRenderer($renderedClassName, $renderer);
}
}
示例3: close
function close()
{
$from = $this->getFrom();
$to = $this->getTo();
if (!empty($this->body) && $from !== null && $to !== null && $this->layout !== null) {
$subject = $this->getSubject();
LoggerLog::debug("LoggerAppenderMail::close() sending mail from=[{$from}] to=[{$to}] subject=[{$subject}]");
@mail($to, $subject, $this->layout->getHeader() . $this->body . $this->layout->getFooter(), "From: {$from}\r\n");
}
$this->closed = true;
}
示例4: setTarget
/**
* Set console target.
* @param mixed $value a constant or a string
*/
public function setTarget($value)
{
$v = trim($value);
if ($v == self::STDOUT || strtoupper($v) == 'STDOUT') {
$this->target = self::STDOUT;
} elseif ($v == self::STDERR || strtoupper($v) == 'STDERR') {
$target = self::STDERR;
} else {
LoggerLog::debug("Invalid target. Using '" . self::STDOUT . "' by default.");
}
}
示例5: append
function append($event)
{
LoggerLog::debug("LoggerAppenderEcho::append()");
if ($this->layout !== null) {
if ($this->firstAppend) {
echo $this->layout->getHeader();
$this->firstAppend = false;
}
echo $this->layout->format($event);
}
}
示例6: append
function append($event)
{
LoggerLog::debug("LoggerAppenderFirePHP::append()");
$message = array("message" => $event->getMessage());
if (function_exists('debug_backtrace')) {
$prevHop = null;
$trace = debug_backtrace();
// make a downsearch to identify the caller
$hop = array_pop($trace);
$step = array();
while ($hop !== null) {
$className = @$hop['class'];
if (!empty($className) and ($className == 'loggercategory' or in_array("LoggerCategory", $this->get_ancestors($className)))) {
$step["file"] = str_replace("\\", "/", str_replace(getcwd(), "", $hop["file"]));
$step["line"] = $hop['line'];
break;
}
$prevHop = $hop;
$hop = array_pop($trace);
}
$step['class'] = isset($prevHop['class']) ? $prevHop['class'] : 'main';
if (isset($prevHop['function']) and $prevHop['function'] !== 'include' and $prevHop['function'] !== 'include_once' and $prevHop['function'] !== 'require' and $prevHop['function'] !== 'require_once') {
$step['function'] = $prevHop['function'];
} else {
$step['function'] = 'main';
}
$message["caller"] = join(":", array($step["file"], $step["class"], $step["function"], $step["line"]));
}
$label = "";
if (isset($message["caller"])) {
$label = " " . $message["caller"];
}
$level =& $event->getLevel();
switch ($level->level) {
case LOG4PHP_LEVEL_INFO_INT:
$code = FirePHP::INFO;
break;
case LOG4PHP_LEVEL_WARN_INT:
$code = FirePHP::WARN;
break;
case LOG4PHP_LEVEL_ERROR_INT:
$code = FirePHP::ERROR;
break;
case LOG4PHP_LEVEL_FATAL_INT:
$code = FirePHP::ERROR;
break;
default:
$code = FirePHP::LOG;
break;
}
$this->firephp->fb($message, $level->levelStr . $label, $code);
}
示例7: append
public function append($event)
{
if ($this->layout !== null) {
LoggerLog::debug("LoggerAppenderPhp::append()");
$level = $event->getLevel();
if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) {
trigger_error($this->layout->format($event), E_USER_ERROR);
} elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) {
trigger_error($this->layout->format($event), E_USER_WARNING);
} else {
trigger_error($this->layout->format($event), E_USER_NOTICE);
}
}
}
示例8:
/**
* @param array $props array of properties
* @param string $appenderName
* @return LoggerAppender
*/
function &parseAppender($props, $appenderName)
{
$appender =& LoggerAppender::singleton($appenderName);
if ($appender !== null) {
LoggerLog::debug("LoggerPropertyConfigurator::parseAppender() " . "Appender [{$appenderName}] was already parsed.");
return $appender;
}
// Appender was not previously initialized.
$prefix = LOG4PHP_LOGGER_PROPERTY_CONFIGURATOR_APPENDER_PREFIX . $appenderName;
$layoutPrefix = $prefix . ".layout";
$appenderClass = @$props[$prefix];
if (!empty($appenderClass)) {
$appender =& LoggerAppender::singleton($appenderName, $appenderClass);
if ($appender === null) {
LoggerLog::warn("LoggerPropertyConfigurator::parseAppender() " . "Could not instantiate appender named [{$appenderName}].");
return null;
}
} else {
LoggerLog::warn("LoggerPropertyConfigurator::parseAppender() " . "Could not instantiate appender named [{$appenderName}] with null className.");
return null;
}
$appender->setName($appenderName);
if ($appender->requiresLayout()) {
LoggerLog::debug("LoggerPropertyConfigurator::parseAppender() " . "Parsing layout section for [{$appenderName}].");
$layoutClass = @$props[$layoutPrefix];
$layoutClass = LoggerOptionConverter::substVars($layoutClass, $props);
if (empty($layoutClass)) {
LoggerLog::warn("LoggerPropertyConfigurator::parseAppender() " . "layout class is empty in '{$layoutPrefix}'. Using Simple layout");
$layout = LoggerLayout::factory('LoggerLayoutSimple');
} else {
$layout = LoggerLayout::factory($layoutClass);
if ($layout === null) {
LoggerLog::warn("LoggerPropertyConfigurator::parseAppender() " . "cannot create layout '{$layoutClass}'. Using Simple layout");
$layout = LoggerLayout::factory('LoggerLayoutSimple');
}
}
LoggerLog::debug("LoggerPropertyConfigurator::parseAppender() " . "Parsing layout options for [{$appenderName}].");
LoggerPropertySetter::setPropertiesByObject($layout, $props, $layoutPrefix . ".");
LoggerLog::debug("LoggerPropertyConfigurator::parseAppender() " . "End Parsing layout options for [{$appenderName}].");
$appender->setLayout($layout);
}
LoggerPropertySetter::setPropertiesByObject($appender, $props, $prefix . ".");
LoggerLog::debug("LoggerPropertyConfigurator::parseAppender() " . "Parsed [{$appenderName}] options.");
return $appender;
}
示例9: LoggerCategoryPatternConverter
/**
* Constructor
*
* @param string $formattingInfo
* @param integer $precision
*/
function LoggerCategoryPatternConverter($formattingInfo, $precision)
{
LoggerLog::debug("LoggerCategoryPatternConverter::LoggerCategoryPatternConverter() precision='{$precision}'");
$this->LoggerNamedPatternConverter($formattingInfo, $precision);
}
示例10: debug
/**
* Report a debug message.
*
* @param string $message log message
* @static
* @since 0.3
*/
public static function debug($message)
{
LoggerLog::log($message, E_USER_NOTICE);
}
示例11: append
function append($event)
{
if ($this->canAppend) {
$query = $this->layout->format($event);
LoggerLog::debug("LoggerAppenderDb::append() query='{$query}'");
$this->db->query($query);
}
}
示例12: setMaxDepth
/**
* Set maximum depth of this diagnostic context. If the current
* depth is smaller or equal to <var>maxDepth</var>, then no
* action is taken.
*
* <p>This method is a convenient alternative to multiple
* {@link pop()} calls. Moreover, it is often the case that at
* the end of complex call sequences, the depth of the NDC is
* unpredictable. The {@link setMaxDepth()} method circumvents
* this problem.
*
* @param integer $maxDepth
* @see getDepth()
* @static
*/
function setMaxDepth($maxDepth)
{
LoggerLog::debug("LoggerNDC::setMaxDepth() maxDepth='{$maxDepth}'");
$maxDepth = (int) $maxDepth;
if ($maxDepth <= LOGGER_NDC_HT_SIZE) {
if (LoggerNDC::getDepth() > $maxDepth) {
$GLOBALS['log4php.LoggerNDC.ht'] = array_slice($GLOBALS['log4php.LoggerNDC.ht'], $maxDepth);
}
$GLOBALS['log4php.LoggerNDC.maxDepth'] = $maxDepth;
}
}
示例13: setter
/**
* @param object $object
* @param string $name
* @param mixed $value
*/
function setter(&$object, $name, $value)
{
if (empty($name)) {
LoggerLog::debug("LoggerDOMConfigurator::setter() 'name' param cannot be empty");
return false;
}
$methodName = 'set' . ucfirst($name);
if (method_exists($object, $methodName)) {
LoggerLog::debug("LoggerDOMConfigurator::setter() Calling " . get_class($object) . "::{$methodName}({$value})");
return call_user_func(array(&$object, $methodName), $value);
} else {
LoggerLog::warn("LoggerDOMConfigurator::setter() " . get_class($object) . "::{$methodName}() does not exists");
return false;
}
}
示例14: finalizeConverter
function finalizeConverter($c)
{
LoggerLog::debug("LoggerPatternParser::finalizeConverter() with char '{$c}'");
$pc = null;
switch ($c) {
case 'c':
$pc = new LoggerCategoryPatternConverter($this->formattingInfo, $this->extractPrecisionOption());
LoggerLog::debug("LoggerPatternParser::finalizeConverter() CATEGORY converter.");
// $this->formattingInfo->dump();
$this->currentLiteral = '';
break;
case 'C':
$pc = new LoggerClassNamePatternConverter($this->formattingInfo, $this->extractPrecisionOption());
LoggerLog::debug("LoggerPatternParser::finalizeConverter() CLASSNAME converter.");
//$this->formattingInfo->dump();
$this->currentLiteral = '';
break;
case 'd':
$dateFormatStr = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601;
// ISO8601_DATE_FORMAT;
$dOpt = $this->extractOption();
if ($dOpt !== null) {
$dateFormatStr = $dOpt;
}
if ($dateFormatStr == 'ISO8601') {
$df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601;
} elseif ($dateFormatStr == 'ABSOLUTE') {
$df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ABSOLUTE;
} elseif ($dateFormatStr == 'DATE') {
$df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_DATE;
} else {
$df = $dateFormatStr;
if ($df == null) {
$df = LOG4PHP_LOGGER_PATTERN_PARSER_DATE_FORMAT_ISO8601;
}
}
$pc = new LoggerDatePatternConverter($this->formattingInfo, $df);
$this->currentLiteral = '';
break;
case 'F':
$pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_FILE_LOCATION_CONVERTER);
LoggerLog::debug("LoggerPatternParser::finalizeConverter() File name converter.");
//formattingInfo.dump();
$this->currentLiteral = '';
break;
case 'l':
$pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_FULL_LOCATION_CONVERTER);
LoggerLog::debug("LoggerPatternParser::finalizeConverter() Location converter.");
//formattingInfo.dump();
$this->currentLiteral = '';
break;
case 'L':
$pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_LINE_LOCATION_CONVERTER);
LoggerLog::debug("LoggerPatternParser::finalizeConverter() LINE NUMBER converter.");
//formattingInfo.dump();
$this->currentLiteral = '';
break;
case 'm':
$pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_MESSAGE_CONVERTER);
LoggerLog::debug("LoggerPatternParser::finalizeConverter() MESSAGE converter.");
//formattingInfo.dump();
$this->currentLiteral = '';
break;
case 'M':
$pc = new LoggerLocationPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_METHOD_LOCATION_CONVERTER);
//LogLog.debug("METHOD converter.");
//formattingInfo.dump();
$this->currentLiteral = '';
break;
case 'p':
$pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_LEVEL_CONVERTER);
//LogLog.debug("LEVEL converter.");
//formattingInfo.dump();
$this->currentLiteral = '';
break;
case 'r':
$pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_RELATIVE_TIME_CONVERTER);
LoggerLog::debug("LoggerPatternParser::finalizeConverter() RELATIVE TIME converter.");
//formattingInfo.dump();
$this->currentLiteral = '';
break;
case 't':
$pc = new LoggerBasicPatternConverter($this->formattingInfo, LOG4PHP_LOGGER_PATTERN_PARSER_THREAD_CONVERTER);
LoggerLog::debug("LoggerPatternParser::finalizeConverter() THREAD converter.");
//formattingInfo.dump();
$this->currentLiteral = '';
break;
case 'u':
if ($this->i < $this->patternLength) {
$cNext = $this->pattern[$this->i];
if (ord($cNext) >= ord('0') && ord($cNext) <= ord('9')) {
$pc = new LoggerUserFieldPatternConverter($this->formattingInfo, (string) (ord($cNext) - ord('0')));
LoggerLog::debug("LoggerPatternParser::finalizeConverter() USER converter [{$cNext}].");
// formattingInfo.dump();
$this->currentLiteral = '';
$this->i++;
} else {
LoggerLog::warn("LoggerPatternParser::finalizeConverter() Unexpected char '{$cNext}' at position {$this->i}.");
}
}
//.........这里部分代码省略.........
示例15: makeNewLoggerInstance
/**
* @abstract
* @param string $name
* @return Logger
*/
function makeNewLoggerInstance($name)
{
LoggerLog::warn("LoggerFactory:: makeNewLoggerInstance() is abstract.");
return null;
}