summaryrefslogtreecommitdiffstats
path: root/lib/Log.php
diff options
context:
space:
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':