changeset 64:164268b4e0d9

Make class of logger.
author Tom Fredrik "BFG" Klaussen <bfg@blenning.no>
date Thu, 11 Oct 2012 20:33:04 +0200
parents 92c3e52c12d4
children 7b87ec8b0842
files CacheTimeCheck.inc logger.inc
diffstat 2 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/CacheTimeCheck.inc	Thu Oct 11 20:26:27 2012 +0200
+++ b/CacheTimeCheck.inc	Thu Oct 11 20:33:04 2012 +0200
@@ -95,7 +95,7 @@
   function cache_time($path)
   {
     if (!file_exists($path)) {
-      warn("${path} does not exist");
+      Logger::warn("${path} does not exist");
       errorPage("Resource is not available");
     }
 
--- a/logger.inc	Thu Oct 11 20:26:27 2012 +0200
+++ b/logger.inc	Thu Oct 11 20:33:04 2012 +0200
@@ -3,17 +3,19 @@
  * @file
  * Common access point for logging
  */
-function logMsg($level, $msg)
-{
-  if (DEBUG_LEVEL >= $level) {
-    print $msg;
-    if(ABORT_ON_LOG)
-      exit;
+class Logger {
+  static function msg($level, $msg)
+  {
+    if (DEBUG_LEVEL >= $level) {
+      print $msg;
+      if(ABORT_ON_LOG)
+	exit;
+    }
+  }
+
+  static function warn($msg)
+  {
+    self::msg(VERBOSITY_WARNING, $msg);
   }
 }
-
-function warn($msg)
-{
-  logMsg(VERBOSITY_WARNING, $msg);
-}
 ?>
\ No newline at end of file