summaryrefslogtreecommitdiffstats
path: root/lib/private/legacy/log.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-09-25 13:36:30 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2013-09-30 16:36:59 +0200
commit9c9dc276b7a1d2592c4fb0a887888632dc1f1e29 (patch)
treebbe3aed3e09c31c68806bdb8acffef70ba08f51c /lib/private/legacy/log.php
parenta711399e62d5a9f14d4b748efe4354ee37e61f13 (diff)
downloadnextcloud-server-9c9dc276b7a1d2592c4fb0a887888632dc1f1e29.tar.gz
nextcloud-server-9c9dc276b7a1d2592c4fb0a887888632dc1f1e29.zip
move the private namespace OC into lib/private - OCP will stay in lib/public
Conflicts: lib/private/vcategories.php
Diffstat (limited to 'lib/private/legacy/log.php')
-rw-r--r--lib/private/legacy/log.php50
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/private/legacy/log.php b/lib/private/legacy/log.php
new file mode 100644
index 00000000000..027cb89e97c
--- /dev/null
+++ b/lib/private/legacy/log.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Copyright (c) 2012 Bart Visscher <bartv@thisnet.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+/**
+ * logging utilities
+ *
+ * Log is saved by default at data/owncloud.log using OC_Log_Owncloud.
+ * Selecting other backend is done with a config option 'log_type'.
+ */
+
+OC_Log::$object = new \OC\Log();
+class OC_Log {
+ public static $object;
+
+ const DEBUG=0;
+ const INFO=1;
+ const WARN=2;
+ const ERROR=3;
+ const FATAL=4;
+
+ static private $level_funcs = array(
+ self::DEBUG => 'debug',
+ self::INFO => 'info',
+ self::WARN => 'warning',
+ self::ERROR => 'error',
+ self::FATAL => 'emergency',
+ );
+
+ static public $enabled = true;
+ static protected $class = null;
+
+ /**
+ * write a message in the log
+ * @param string $app
+ * @param string $message
+ * @param int $level
+ */
+ public static function write($app, $message, $level) {
+ if (self::$enabled) {
+ $context = array('app' => $app);
+ $func = array(self::$object, self::$level_funcs[$level]);
+ call_user_func($func, $message, $context);
+ }
+ }
+}