[18220] | 1 | <?php
|
---|
| 2 | /**
|
---|
| 3 | * log4php is a PHP port of the log4j java logging package.
|
---|
| 4 | *
|
---|
| 5 | * <p>This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).</p>
|
---|
| 6 | * <p>Design, strategies and part of the methods documentation are developed by log4j team
|
---|
| 7 | * (Ceki Gülcü as log4j project founder and
|
---|
| 8 | * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).</p>
|
---|
| 9 | *
|
---|
| 10 | * <p>PHP port, extensions and modifications by VxR. All rights reserved.<br>
|
---|
| 11 | * For more information, please see {@link http://www.vxr.it/log4php/}.</p>
|
---|
| 12 | *
|
---|
| 13 | * <p>This software is published under the terms of the LGPL License
|
---|
| 14 | * a copy of which has been included with this distribution in the LICENSE file.</p>
|
---|
| 15 | *
|
---|
| 16 | * @package log4php
|
---|
| 17 | */
|
---|
| 18 |
|
---|
| 19 | /**
|
---|
| 20 | * @ignore
|
---|
| 21 | */
|
---|
| 22 | if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__));
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | */
|
---|
| 26 | require_once(LOG4PHP_DIR . '/LoggerHierarchy.php');
|
---|
| 27 | require_once(LOG4PHP_DIR . '/LoggerLevel.php');
|
---|
| 28 | require_once(LOG4PHP_DIR . '/spi/LoggerLoggingEvent.php');
|
---|
| 29 |
|
---|
| 30 | /**
|
---|
| 31 | * This class has been deprecated and replaced by the Logger subclass.
|
---|
| 32 | *
|
---|
| 33 | * @author VxR <vxr@vxr.it>
|
---|
| 34 | * @version $Revision: 1.16 $
|
---|
| 35 | * @package log4php
|
---|
| 36 | * @see Logger
|
---|
| 37 | */
|
---|
| 38 | class LoggerCategory {
|
---|
| 39 |
|
---|
| 40 | /**
|
---|
| 41 | * Additivity is set to true by default, that is children inherit the
|
---|
| 42 | * appenders of their ancestors by default.
|
---|
| 43 | * @var boolean
|
---|
| 44 | */
|
---|
| 45 | var $additive = true;
|
---|
| 46 |
|
---|
| 47 | /**
|
---|
| 48 | * @var string fully qualified class name
|
---|
| 49 | */
|
---|
| 50 | var $fqcn = 'LoggerCategory';
|
---|
| 51 |
|
---|
| 52 | /**
|
---|
| 53 | * @var LoggerLevel The assigned level of this category.
|
---|
| 54 | */
|
---|
| 55 | var $level = null;
|
---|
| 56 |
|
---|
| 57 | /**
|
---|
| 58 | * @var string name of this category.
|
---|
| 59 | */
|
---|
| 60 | var $name = '';
|
---|
| 61 |
|
---|
| 62 | /**
|
---|
| 63 | * @var Logger The parent of this category.
|
---|
| 64 | */
|
---|
| 65 | var $parent = null;
|
---|
| 66 |
|
---|
| 67 | /**
|
---|
| 68 | * @var LoggerHierarchy the object repository
|
---|
| 69 | */
|
---|
| 70 | var $repository = null;
|
---|
| 71 |
|
---|
| 72 | /**
|
---|
| 73 | * @var array collection of appenders
|
---|
| 74 | * @see LoggerAppender
|
---|
| 75 | */
|
---|
| 76 | var $aai = array();
|
---|
| 77 |
|
---|
| 78 | /* --------------------------------------------------------------------------*/
|
---|
| 79 | /* --------------------------------------------------------------------------*/
|
---|
| 80 | /* --------------------------------------------------------------------------*/
|
---|
| 81 |
|
---|
| 82 | /**
|
---|
| 83 | * Constructor.
|
---|
| 84 | *
|
---|
| 85 | * @param string $name Category name
|
---|
| 86 | */
|
---|
| 87 | function LoggerCategory($name)
|
---|
| 88 | {
|
---|
| 89 | $this->name = $name;
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | /**
|
---|
| 93 | * Add a new Appender to the list of appenders of this Category instance.
|
---|
| 94 | *
|
---|
| 95 | * @param LoggerAppender $newAppender
|
---|
| 96 | */
|
---|
| 97 | function addAppender(&$newAppender)
|
---|
| 98 | {
|
---|
| 99 | $appenderName = $newAppender->getName();
|
---|
| 100 | $this->aai[$appenderName] =& $newAppender;
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | /**
|
---|
| 104 | * If assertion parameter is false, then logs msg as an error statement.
|
---|
| 105 | *
|
---|
| 106 | * @param bool $assertion
|
---|
| 107 | * @param string $msg message to log
|
---|
| 108 | */
|
---|
| 109 | function assertLog($assertion = true, $msg = '')
|
---|
| 110 | {
|
---|
| 111 | if ($assertion == false) {
|
---|
| 112 | $this->error($msg);
|
---|
| 113 | }
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | /**
|
---|
| 117 | * Call the appenders in the hierarchy starting at this.
|
---|
| 118 | *
|
---|
| 119 | * @param LoggerLoggingEvent $event
|
---|
| 120 | */
|
---|
| 121 | function callAppenders($event)
|
---|
| 122 | {
|
---|
| 123 | if (sizeof($this->aai) > 0) {
|
---|
| 124 | foreach (array_keys($this->aai) as $appenderName) {
|
---|
| 125 | $this->aai[$appenderName]->doAppend($event);
|
---|
| 126 | }
|
---|
| 127 | }
|
---|
| 128 | if ($this->parent != null and $this->getAdditivity()) {
|
---|
| 129 | $this->parent->callAppenders($event);
|
---|
| 130 | }
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 | /**
|
---|
| 134 | * Log a message object with the DEBUG level including the caller.
|
---|
| 135 | *
|
---|
| 136 | * @param mixed $message message
|
---|
| 137 | * @param mixed $caller caller object or caller string id
|
---|
| 138 | */
|
---|
| 139 | function debug($message, $caller = null)
|
---|
| 140 | {
|
---|
| 141 | $debugLevel = LoggerLevel::getLevelDebug();
|
---|
| 142 | if ($this->repository->isDisabled($debugLevel)) {
|
---|
| 143 | return;
|
---|
| 144 | }
|
---|
| 145 | if ($debugLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
|
---|
| 146 | $this->forcedLog($this->fqcn, $caller, $debugLevel, $message);
|
---|
| 147 | }
|
---|
| 148 | }
|
---|
| 149 |
|
---|
| 150 | /**
|
---|
| 151 | * Log a message object with the ERROR level including the caller.
|
---|
| 152 | *
|
---|
| 153 | * @param mixed $message message
|
---|
| 154 | * @param mixed $caller caller object or caller string id
|
---|
| 155 | */
|
---|
| 156 | function error($message, $caller = null)
|
---|
| 157 | {
|
---|
| 158 | $errorLevel = LoggerLevel::getLevelError();
|
---|
| 159 | if ($this->repository->isDisabled($errorLevel)) {
|
---|
| 160 | return;
|
---|
| 161 | }
|
---|
| 162 | if ($errorLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
|
---|
| 163 | $this->forcedLog($this->fqcn, $caller, $errorLevel, $message);
|
---|
| 164 | }
|
---|
| 165 | }
|
---|
| 166 |
|
---|
| 167 | /**
|
---|
| 168 | * Deprecated. Please use LoggerManager::exists() instead.
|
---|
| 169 | *
|
---|
| 170 | * @param string $name
|
---|
| 171 | * @see LoggerManager::exists()
|
---|
| 172 | * @deprecated
|
---|
| 173 | */
|
---|
| 174 | function exists($name)
|
---|
| 175 | {
|
---|
| 176 | return LoggerManager::exists($name);
|
---|
| 177 | }
|
---|
| 178 |
|
---|
| 179 | /**
|
---|
| 180 | * Log a message object with the FATAL level including the caller.
|
---|
| 181 | *
|
---|
| 182 | * @param mixed $message message
|
---|
| 183 | * @param mixed $caller caller object or caller string id
|
---|
| 184 | */
|
---|
| 185 | function fatal($message, $caller = null)
|
---|
| 186 | {
|
---|
| 187 | $fatalLevel = LoggerLevel::getLevelFatal();
|
---|
| 188 | if ($this->repository->isDisabled($fatalLevel)) {
|
---|
| 189 | return;
|
---|
| 190 | }
|
---|
| 191 | if ($fatalLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
|
---|
| 192 | $this->forcedLog($this->fqcn, $caller, $fatalLevel, $message);
|
---|
| 193 | }
|
---|
| 194 | }
|
---|
| 195 |
|
---|
| 196 | /**
|
---|
| 197 | * This method creates a new logging event and logs the event without further checks.
|
---|
| 198 | *
|
---|
| 199 | * It should not be called directly. Use {@link info()}, {@link debug()}, {@link warn()},
|
---|
| 200 | * {@link error()} and {@link fatal()} wrappers.
|
---|
| 201 | *
|
---|
| 202 | * @param string $fqcn Fully Qualified Class Name of the Logger
|
---|
| 203 | * @param mixed $caller caller object or caller string id
|
---|
| 204 | * @param LoggerLevel $level log level
|
---|
| 205 | * @param mixed $message message
|
---|
| 206 | * @see LoggerLoggingEvent
|
---|
| 207 | */
|
---|
| 208 | function forcedLog($fqcn, $caller, $level, $message)
|
---|
| 209 | {
|
---|
| 210 | // $fqcn = is_object($caller) ? get_class($caller) : (string)$caller;
|
---|
| 211 | $this->callAppenders(new LoggerLoggingEvent($fqcn, $this, $level, $message));
|
---|
| 212 | }
|
---|
| 213 |
|
---|
| 214 | /**
|
---|
| 215 | * Get the additivity flag for this Category instance.
|
---|
| 216 | * @return boolean
|
---|
| 217 | */
|
---|
| 218 | function getAdditivity()
|
---|
| 219 | {
|
---|
| 220 | return $this->additive;
|
---|
| 221 | }
|
---|
| 222 |
|
---|
| 223 | /**
|
---|
| 224 | * Get the appenders contained in this category as an array.
|
---|
| 225 | * @return array collection of appenders
|
---|
| 226 | */
|
---|
| 227 | function &getAllAppenders()
|
---|
| 228 | {
|
---|
| 229 | $appenders = array();
|
---|
| 230 | $appenderNames = array_keys($this->aai);
|
---|
| 231 | $enumAppenders = sizeof($appenderNames);
|
---|
| 232 | for ($i = 0; $i < $enumAppenders; $i++) {
|
---|
| 233 | $appenderName = $appenderNames[$i];
|
---|
| 234 | $appenders[] =& $this->aai[$appenderName];
|
---|
| 235 | }
|
---|
| 236 | return $appenders;
|
---|
| 237 | }
|
---|
| 238 |
|
---|
| 239 | /**
|
---|
| 240 | * Look for the appender named as name.
|
---|
| 241 | * @return LoggerAppender
|
---|
| 242 | */
|
---|
| 243 | function &getAppender($name)
|
---|
| 244 | {
|
---|
| 245 | return $this->aai[$name];
|
---|
| 246 | }
|
---|
| 247 |
|
---|
| 248 | /**
|
---|
| 249 | * Please use the {@link getEffectiveLevel()} method instead.
|
---|
| 250 | * @deprecated
|
---|
| 251 | */
|
---|
| 252 | function getChainedPriority()
|
---|
| 253 | {
|
---|
| 254 | return $this->getEffectiveLevel();
|
---|
| 255 | }
|
---|
| 256 |
|
---|
| 257 | /**
|
---|
| 258 | * Please use {@link LoggerManager::getCurrentLoggers()} instead.
|
---|
| 259 | * @deprecated
|
---|
| 260 | */
|
---|
| 261 | function getCurrentCategories()
|
---|
| 262 | {
|
---|
| 263 | return LoggerManager::getCurrentLoggers();
|
---|
| 264 | }
|
---|
| 265 |
|
---|
| 266 | /**
|
---|
| 267 | * Please use {@link LoggerManager::getLoggerRepository()} instead.
|
---|
| 268 | * @deprecated
|
---|
| 269 | */
|
---|
| 270 | function &getDefaultHierarchy()
|
---|
| 271 | {
|
---|
| 272 | return LoggerManager::getLoggerRepository();
|
---|
| 273 | }
|
---|
| 274 |
|
---|
| 275 | /**
|
---|
| 276 | * @deprecated Use {@link getLoggerRepository()}
|
---|
| 277 | * @return LoggerHierarchy
|
---|
| 278 | */
|
---|
| 279 | function &getHierarchy()
|
---|
| 280 | {
|
---|
| 281 | return $this->getLoggerRepository();
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | /**
|
---|
| 285 | * Starting from this category, search the category hierarchy for a non-null level and return it.
|
---|
| 286 | * @see LoggerLevel
|
---|
| 287 | * @return LoggerLevel or null
|
---|
| 288 | */
|
---|
| 289 | function getEffectiveLevel()
|
---|
| 290 | {
|
---|
| 291 | for($c = $this; $c != null; $c = $c->parent) {
|
---|
| 292 | if($c->level !== null)
|
---|
| 293 | return $c->level;
|
---|
| 294 | }
|
---|
| 295 | return null;
|
---|
| 296 | }
|
---|
| 297 |
|
---|
| 298 | /**
|
---|
| 299 | * Retrieve a category with named as the name parameter.
|
---|
| 300 | * @return Logger
|
---|
| 301 | */
|
---|
| 302 | function &getInstance($name)
|
---|
| 303 | {
|
---|
| 304 | return LoggerManager::getLogger($name);
|
---|
| 305 | }
|
---|
| 306 |
|
---|
| 307 | /**
|
---|
| 308 | * Returns the assigned Level, if any, for this Category.
|
---|
| 309 | * @return LoggerLevel or null
|
---|
| 310 | */
|
---|
| 311 | function getLevel()
|
---|
| 312 | {
|
---|
| 313 | return $this->level;
|
---|
| 314 | }
|
---|
| 315 |
|
---|
| 316 | /**
|
---|
| 317 | * Return the the repository where this Category is attached.
|
---|
| 318 | * @return LoggerHierarchy
|
---|
| 319 | */
|
---|
| 320 | function &getLoggerRepository()
|
---|
| 321 | {
|
---|
| 322 | return $this->repository;
|
---|
| 323 | }
|
---|
| 324 |
|
---|
| 325 | /**
|
---|
| 326 | * Return the category name.
|
---|
| 327 | * @return string
|
---|
| 328 | */
|
---|
| 329 | function getName()
|
---|
| 330 | {
|
---|
| 331 | return $this->name;
|
---|
| 332 | }
|
---|
| 333 |
|
---|
| 334 | /**
|
---|
| 335 | * Returns the parent of this category.
|
---|
| 336 | * @return Logger
|
---|
| 337 | */
|
---|
| 338 | function &getParent()
|
---|
| 339 | {
|
---|
| 340 | return $this->parent;
|
---|
| 341 | }
|
---|
| 342 |
|
---|
| 343 | /**
|
---|
| 344 | * Please use getLevel() instead.
|
---|
| 345 | * @deprecated
|
---|
| 346 | */
|
---|
| 347 | function getPriority()
|
---|
| 348 | {
|
---|
| 349 | return $this->getLevel();
|
---|
| 350 | }
|
---|
| 351 |
|
---|
| 352 | /**
|
---|
| 353 | * Return the inherited ResourceBundle for this category.
|
---|
| 354 | */
|
---|
| 355 | function getResourceBundle()
|
---|
| 356 | {
|
---|
| 357 | return;
|
---|
| 358 | }
|
---|
| 359 |
|
---|
| 360 | /**
|
---|
| 361 | * Returns the string resource coresponding to key in this category's inherited resource bundle.
|
---|
| 362 | */
|
---|
| 363 | function getResourceBundleString($key)
|
---|
| 364 | {
|
---|
| 365 | return;
|
---|
| 366 | }
|
---|
| 367 |
|
---|
| 368 | /**
|
---|
| 369 | * Return the root of the default category hierrachy.
|
---|
| 370 | * @return LoggerRoot
|
---|
| 371 | */
|
---|
| 372 | function &getRoot()
|
---|
| 373 | {
|
---|
| 374 | return LoggerManager::getRootLogger();
|
---|
| 375 | }
|
---|
| 376 |
|
---|
| 377 | /**
|
---|
| 378 | * Log a message object with the INFO Level.
|
---|
| 379 | *
|
---|
| 380 | * @param mixed $message message
|
---|
| 381 | * @param mixed $caller caller object or caller string id
|
---|
| 382 | */
|
---|
| 383 | function info($message, $caller = null)
|
---|
| 384 | {
|
---|
| 385 | $infoLevel = LoggerLevel::getLevelInfo();
|
---|
| 386 | if ($this->repository->isDisabled($infoLevel)) {
|
---|
| 387 | return;
|
---|
| 388 | }
|
---|
| 389 | if ($infoLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
|
---|
| 390 | $this->forcedLog($this->fqcn, $caller, $infoLevel, $message);
|
---|
| 391 | }
|
---|
| 392 | }
|
---|
| 393 |
|
---|
| 394 | /**
|
---|
| 395 | * Is the appender passed as parameter attached to this category?
|
---|
| 396 | *
|
---|
| 397 | * @param LoggerAppender $appender
|
---|
| 398 | */
|
---|
| 399 | function isAttached($appender)
|
---|
| 400 | {
|
---|
| 401 | return in_array($appender->getName(), array_keys($this->aai));
|
---|
| 402 | }
|
---|
| 403 |
|
---|
| 404 | /**
|
---|
| 405 | * Check whether this category is enabled for the DEBUG Level.
|
---|
| 406 | * @return boolean
|
---|
| 407 | */
|
---|
| 408 | function isDebugEnabled()
|
---|
| 409 | {
|
---|
| 410 | $debugLevel = LoggerLevel::getLevelDebug();
|
---|
| 411 | if ($this->repository->isDisabled($debugLevel)) {
|
---|
| 412 | return false;
|
---|
| 413 | }
|
---|
| 414 | return ($debugLevel->isGreaterOrEqual($this->getEffectiveLevel()));
|
---|
| 415 | }
|
---|
| 416 |
|
---|
| 417 | /**
|
---|
| 418 | * Check whether this category is enabled for a given Level passed as parameter.
|
---|
| 419 | *
|
---|
| 420 | * @param LoggerLevel level
|
---|
| 421 | * @return boolean
|
---|
| 422 | */
|
---|
| 423 | function isEnabledFor($level)
|
---|
| 424 | {
|
---|
| 425 | if ($this->repository->isDisabled($level)) {
|
---|
| 426 | return false;
|
---|
| 427 | }
|
---|
| 428 | return (bool)($level->isGreaterOrEqual($this->getEffectiveLevel()));
|
---|
| 429 | }
|
---|
| 430 |
|
---|
| 431 | /**
|
---|
| 432 | * Check whether this category is enabled for the info Level.
|
---|
| 433 | * @return boolean
|
---|
| 434 | * @see LoggerLevel
|
---|
| 435 | */
|
---|
| 436 | function isInfoEnabled()
|
---|
| 437 | {
|
---|
| 438 | $infoLevel = LoggerLevel::getLevelInfo();
|
---|
| 439 | if ($this->repository->isDisabled($infoLevel)) {
|
---|
| 440 | return false;
|
---|
| 441 | }
|
---|
| 442 | return ($infoLevel->isGreaterOrEqual($this->getEffectiveLevel()));
|
---|
| 443 | }
|
---|
| 444 |
|
---|
| 445 | /**
|
---|
| 446 | * Log a localized and parameterized message.
|
---|
| 447 | */
|
---|
| 448 | function l7dlog($priority, $key, $params, $t)
|
---|
| 449 | {
|
---|
| 450 | return;
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 | /**
|
---|
| 454 | * This generic form is intended to be used by wrappers.
|
---|
| 455 | *
|
---|
| 456 | * @param LoggerLevel $priority a valid level
|
---|
| 457 | * @param mixed $message message
|
---|
| 458 | * @param mixed $caller caller object or caller string id
|
---|
| 459 | */
|
---|
| 460 | function log($priority, $message, $caller = null)
|
---|
| 461 | {
|
---|
| 462 | if ($this->repository->isDisabled($priority)) {
|
---|
| 463 | return;
|
---|
| 464 | }
|
---|
| 465 | if ($priority->isGreaterOrEqual($this->getEffectiveLevel())) {
|
---|
| 466 | $this->forcedLog($this->fqcn, $caller, $priority, $message);
|
---|
| 467 | }
|
---|
| 468 | }
|
---|
| 469 |
|
---|
| 470 | /**
|
---|
| 471 | * Remove all previously added appenders from this Category instance.
|
---|
| 472 | */
|
---|
| 473 | function removeAllAppenders()
|
---|
| 474 | {
|
---|
| 475 | $appenderNames = array_keys($this->aai);
|
---|
| 476 | $enumAppenders = sizeof($appenderNames);
|
---|
| 477 | for ($i = 0; $i < $enumAppenders; $i++) {
|
---|
| 478 | $this->removeAppender($appenderNames[$i]);
|
---|
| 479 | }
|
---|
| 480 | }
|
---|
| 481 |
|
---|
| 482 | /**
|
---|
| 483 | * Remove the appender passed as parameter form the list of appenders.
|
---|
| 484 | *
|
---|
| 485 | * @param mixed $appender can be an appender name or a {@link LoggerAppender} object
|
---|
| 486 | */
|
---|
| 487 | function removeAppender($appender)
|
---|
| 488 | {
|
---|
| 489 | if (is_a($appender, 'loggerappender')) {
|
---|
| 490 | $appender->close();
|
---|
| 491 | unset($this->aai[$appender->getName()]);
|
---|
| 492 | } elseif (is_string($appender) and isset($this->aai[$appender])) {
|
---|
| 493 | $this->aai[$appender]->close();
|
---|
| 494 | unset($this->aai[$appender]);
|
---|
| 495 | }
|
---|
| 496 | }
|
---|
| 497 |
|
---|
| 498 | /**
|
---|
| 499 | * Set the additivity flag for this Category instance.
|
---|
| 500 | *
|
---|
| 501 | * @param boolean $additive
|
---|
| 502 | */
|
---|
| 503 | function setAdditivity($additive)
|
---|
| 504 | {
|
---|
| 505 | $this->additive = (bool)$additive;
|
---|
| 506 | }
|
---|
| 507 |
|
---|
| 508 | /**
|
---|
| 509 | * @deprecated Please use {@link setLevel()} instead.
|
---|
| 510 | * @see setLevel()
|
---|
| 511 | */
|
---|
| 512 | function setPriority($priority)
|
---|
| 513 | {
|
---|
| 514 | $this->setLevel($priority);
|
---|
| 515 | }
|
---|
| 516 |
|
---|
| 517 | /**
|
---|
| 518 | * Only the Hiearchy class can set the hiearchy of a
|
---|
| 519 | * category.
|
---|
| 520 | *
|
---|
| 521 | * @param LoggerHierarchy &$repository
|
---|
| 522 | */
|
---|
| 523 | function setHierarchy(&$repository)
|
---|
| 524 | {
|
---|
| 525 | $this->repository =& $repository;
|
---|
| 526 | }
|
---|
| 527 |
|
---|
| 528 | /**
|
---|
| 529 | * Set the level of this Category.
|
---|
| 530 | *
|
---|
| 531 | * @param LoggerLevel $level a level string or a level costant
|
---|
| 532 | */
|
---|
| 533 | function setLevel($level)
|
---|
| 534 | {
|
---|
| 535 | $this->level = $level;
|
---|
| 536 | }
|
---|
| 537 |
|
---|
| 538 | /**
|
---|
| 539 | * Set the resource bundle to be used with localized logging methods
|
---|
| 540 | */
|
---|
| 541 | function setResourceBundle($bundle)
|
---|
| 542 | {
|
---|
| 543 | return;
|
---|
| 544 | }
|
---|
| 545 |
|
---|
| 546 | /**
|
---|
| 547 | * @deprecated use {@link LoggerManager::shutdown()} instead.
|
---|
| 548 | * @see LoggerManager::shutdown()
|
---|
| 549 | */
|
---|
| 550 | function shutdown()
|
---|
| 551 | {
|
---|
| 552 | LoggerManager::shutdown();
|
---|
| 553 | }
|
---|
| 554 |
|
---|
| 555 | /**
|
---|
| 556 | * Log a message with the WARN level.
|
---|
| 557 | *
|
---|
| 558 | * @param mixed $message message
|
---|
| 559 | * @param mixed $caller caller object or caller string id
|
---|
| 560 | */
|
---|
| 561 | function warn($message, $caller = null)
|
---|
| 562 | {
|
---|
| 563 | $warnLevel = LoggerLevel::getLevelWarn();
|
---|
| 564 | if ($this->repository->isDisabled($warnLevel)) {
|
---|
| 565 | return;
|
---|
| 566 | }
|
---|
| 567 | if ($warnLevel->isGreaterOrEqual($this->getEffectiveLevel())) {
|
---|
| 568 | $this->forcedLog($this->fqcn, $caller, $warnLevel, $message);
|
---|
| 569 | }
|
---|
| 570 | }
|
---|
| 571 |
|
---|
| 572 | }
|
---|
| 573 | ?> |
---|