summaryrefslogtreecommitdiffstats
path: root/lib/Log.php
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2012-08-07 15:44:10 +0200
committerAleksander Machniak <machniak@kolabsys.com>2012-08-07 15:44:10 +0200
commit9a2666445c4c7f0309e0b30c57d8c3100d2bf547 (patch)
tree832e79e3955deb3bd5a4b84b0fa01d279ad8fb63 /lib/Log.php
parent84056dc6dc90cb0508c87e70d57cdf056e4b7ef3 (diff)
downloadwebadmin-9a2666445c4c7f0309e0b30c57d8c3100d2bf547.tar.gz
Added TRACE mode
Diffstat (limited to 'lib/Log.php')
-rw-r--r--lib/Log.php26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/Log.php b/lib/Log.php
index 2ddb99b..ed01332 100644
--- a/lib/Log.php
+++ b/lib/Log.php
@@ -27,8 +27,9 @@
*/
class Log
{
+ const TRACE = 16; // use for protocol tracking: sql queries, ldap commands, etc.
const DEBUG = 8;
- const INFO = 4;
+ const INFO = 4; // use to log entry creation/update/delete etc.
const WARNING = 2;
const ERROR = 0;
@@ -36,6 +37,19 @@ class Log
/**
+ * Logs tracing message
+ *
+ * @param string $message Log message
+ * @param array $args Additional arguments ('file', 'line')
+ */
+ static function trace($message, $args = array())
+ {
+ if (self::mode() >= self::TRACE) {
+ self::log_message(self::TRACE, $message, $args);
+ }
+ }
+
+ /**
* Logs debug message
*
* @param string $message Log message
@@ -103,6 +117,7 @@ class Log
// otherwise use separate file for info/debug and warning/error
if (!$logfile) {
switch ($mode) {
+ case self::TRACE:
case self::DEBUG:
case self::INFO:
$file = 'console';
@@ -117,6 +132,9 @@ class Log
}
switch ($mode) {
+ case self::TRACE:
+ $prefix = 'TRACE';
+ break;
case self::DEBUG:
$prefix = 'DEBUG';
break;
@@ -177,6 +195,12 @@ class Log
$mode = $conf->get('kolab_wap', 'debug_mode');
switch ($mode) {
+ case self::TRACE:
+ case 'trace':
+ case 'TRACE':
+ self::$mode = self::TRACE;
+ break;
+
case self::DEBUG:
case 'debug':
case 'DEBUG':