wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
class.Log.php
Go to the documentation of this file.
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2014 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of any of the following licenses
7  * at your choice:
8  *
9  * - GNU Lesser General Public License (LGPL)
10  * http://www.gnu.org/licenses/lgpl.html
11  * - Eclipse Public License (EPL)
12  * http://www.eclipse.org/org/documents/epl-v10.php
13  *
14  * See the license.txt file distributed with this work for
15  * additional information.
16  *
17  * $Id: class.Log.php 1462 2014-02-04 23:52:27Z iherwig $
18  */
19 require_once(BASE."wcmf/3rdparty/log4php/src/main/php/LoggerManager.php");
20 require_once(BASE."wcmf/3rdparty/log4php/src/main/php/Logger.php");
21 
22 /**
23  * @class Log
24  * @ingroup Util
25  * @brief Log is used to log application events. The implementation
26  * is a wrapper over log4php. All methods may be called in a static way.
27  * @note This only reason, why this class inherits from Logger is to get the
28  * correct location information.
29  *
30  * @author ingo herwig <ingo@wemove.com>
31  */
32 class Log extends Logger
33 {
34  /**
35  * Print a debug message for a category
36  * @param message The message
37  * @param category The category
38  */
39  function debug($message, $category)
40  {
41  $logger = &Log::getLogger($category);
42  $logger->debug($message);
43  }
44  /**
45  * Print a info message for a category
46  * @param message The message
47  * @param category The category
48  */
49  function info($message, $category)
50  {
51  $logger = &Log::getLogger($category);
52  $logger->info($message);
53  }
54  /**
55  * Print a warn message for a category
56  * @param message The message
57  * @param category The category
58  */
59  function warn($message, $category)
60  {
61  $logger = &Log::getLogger($category);
62  $logger->warn($message);
63  }
64  /**
65  * Print a error message for a category
66  * @param message The message
67  * @param category The category
68  */
69  function error($message, $category)
70  {
71  $logger = &Log::getLogger($category);
72  $logger->error($message);
73  }
74  /**
75  * Print a fatal message for a category
76  * @param message The message
77  * @param category The category
78  */
79  function fatal($message, $category)
80  {
81  $logger = &Log::getLogger($category);
82  $logger->fatal($message);
83  }
84  /**
85  * Check if debug level is enabled for a category
86  * @param category The category
87  * @return True/False
88  */
89  function isDebugEnabled($category)
90  {
91  $logger = &Log::getLogger($category);
92  return $logger->isDebugEnabled();
93  }
94  /**
95  * Check if info level is enabled for a category
96  * @param category The category
97  * @return True/False
98  */
99  function isInfoEnabled($category)
100  {
101  $logger = &Log::getLogger($category);
102  return $logger->isInfoEnabled();
103  }
104  /**
105  * Check if warn level is enabled for a category
106  * @param category The category
107  * @return True/False
108  */
109  function isWarnEnabled($category)
110  {
111  $logger = &Log::getLogger($category);
112  return $logger->isWarnEnabled();
113  }
114  /**
115  * Check if error level is enabled for a category
116  * @param category The category
117  * @return True/False
118  */
119  function isErrorEnabled($category)
120  {
121  $logger = &Log::getLogger($category);
122  return $logger->isErrorEnabled();
123  }
124  /**
125  * Check if fatal level is enabled for a category
126  * @param category The category
127  * @return True/False
128  */
129  function isFatalEnabled($category)
130  {
131  $logger = &Log::getLogger($category);
132  return $logger->isFatalEnabled();
133  }
134 
135  /**
136  * Get the log4php Logger instance for a specified category
137  * @param category The category
138  * @return A Logger The category
139  */
140  function &getLogger($category)
141  {
142  $logger = &LoggerManager::getLogger($category);
143  return $logger;
144  }
145 }
146 ?>
isWarnEnabled($category)
Definition: class.Log.php:109
error($message, $category)
Definition: class.Log.php:69
debug($message, $category)
Definition: class.Log.php:39
warn($message, $category)
Definition: class.Log.php:59
info($message, $category)
Definition: class.Log.php:49
isErrorEnabled($category)
Definition: class.Log.php:119
isInfoEnabled($category)
Definition: class.Log.php:99
isFatalEnabled($category)
Definition: class.Log.php:129
isDebugEnabled($category)
Definition: class.Log.php:89
Log is used to log application events. The implementation is a wrapper over log4php. All methods may be called in a static way.
Definition: class.Log.php:32
fatal($message, $category)
Definition: class.Log.php:79
& getLogger($category)
Definition: class.Log.php:140