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 . '/LoggerLevel.php');
|
---|
27 | require_once(LOG4PHP_DIR . '/Logger.php');
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * The root logger.
|
---|
31 | *
|
---|
32 | * @author VxR <vxr@vxr.it>
|
---|
33 | * @version $Revision: 1.8 $
|
---|
34 | * @package log4php
|
---|
35 | * @see Logger
|
---|
36 | */
|
---|
37 | class LoggerRoot extends Logger {
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * @var string name of logger
|
---|
41 | */
|
---|
42 | var $name = 'root';
|
---|
43 |
|
---|
44 | /**
|
---|
45 | * @var object must be null for LoggerRoot
|
---|
46 | */
|
---|
47 | var $parent = null;
|
---|
48 |
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Constructor
|
---|
52 | *
|
---|
53 | * @param integer $level initial log level
|
---|
54 | */
|
---|
55 | function LoggerRoot($level = null)
|
---|
56 | {
|
---|
57 | $this->Logger($this->name);
|
---|
58 | if ($level == null)
|
---|
59 | $level = LoggerLevel::getLevelAll();
|
---|
60 | $this->setLevel($level);
|
---|
61 | }
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * @return integer the level
|
---|
65 | */
|
---|
66 | function getChainedLevel()
|
---|
67 | {
|
---|
68 | return $this->level;
|
---|
69 | }
|
---|
70 |
|
---|
71 | /**
|
---|
72 | * Setting a null value to the level of the root category may have catastrophic results.
|
---|
73 | * @param LoggerLevel $level
|
---|
74 | */
|
---|
75 | function setLevel($level)
|
---|
76 | {
|
---|
77 | $this->level = $level;
|
---|
78 | }
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * Please use setLevel() instead.
|
---|
82 | * @param LoggerLevel $level
|
---|
83 | * @deprecated
|
---|
84 | */
|
---|
85 | function setPriority($level)
|
---|
86 | {
|
---|
87 | $this->setLevel($level);
|
---|
88 | }
|
---|
89 |
|
---|
90 | /**
|
---|
91 | * Always returns false.
|
---|
92 | * Because LoggerRoot has no parents, it returns false.
|
---|
93 | * @param Logger $parent
|
---|
94 | * @return boolean
|
---|
95 | */
|
---|
96 | function setParent($parent)
|
---|
97 | {
|
---|
98 | return false;
|
---|
99 | }
|
---|
100 | }
|
---|
101 | ?> |
---|