diff Logger.inc.php @ 134:b6b4a58c7625

Using .inc.php rather than just .inc for include files.
author Tom Fredrik Blenning <bfg@bfgconsult.no>
date Sun, 22 Jan 2023 19:22:00 +0100
parents Logger.inc@74f7b64bdb78
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Logger.inc.php	Sun Jan 22 19:22:00 2023 +0100
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Common access point for logging
+ */
+class Logger {
+  /**
+   * All logging goes through this function
+   *
+   * @param $level the severity level of this message
+   * @param $msg message to be logged
+   */
+  static function msg($level, $msg)
+  {
+    if (DEBUG_LEVEL >= $level) {
+      print $msg;
+      if(ABORT_ON_LOG)
+	exit;
+    }
+  }
+
+  /**
+   * Convenience function, logs a message with level VERBOSITY_WARNING
+   *
+   * @param $msg message to be logged
+   */
+  static function warn($msg)
+  {
+    self::msg(VERBOSITY_WARNING, $msg);
+  }
+}
+?>
\ No newline at end of file