diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-03-30 23:40:16 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-03-30 23:41:54 +0200 |
commit | 20fc23c82bbcaff56caafe6a6cc0ef15db9b2bf8 (patch) | |
tree | d4f06a3436f790a7506c72df5dbdb07950da6a4d | |
parent | 3300d6ea532a973e987c7aeeef1af63a60487c58 (diff) | |
download | nextcloud-server-20fc23c82bbcaff56caafe6a6cc0ef15db9b2bf8.tar.gz nextcloud-server-20fc23c82bbcaff56caafe6a6cc0ef15db9b2bf8.zip |
Move logfile determination to init function
-rw-r--r-- | lib/log/owncloud.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/log/owncloud.php b/lib/log/owncloud.php index 6df346e9b17..5e143205563 100644 --- a/lib/log/owncloud.php +++ b/lib/log/owncloud.php @@ -27,10 +27,14 @@ */ class OC_Log_Owncloud { + static protected $logFile; + /** * Init class data */ public static function init() { + $datadir=OC_Config::getValue( "datadirectory", OC::$SERVERROOT.'/data' ); + self::$logFile=OC_Config::getValue( "logfile", $datadir.'/owncloud.log' ); } /** @@ -42,10 +46,8 @@ class OC_Log_Owncloud { public static function write($app, $message, $level) { $minLevel=OC_Config::getValue( "loglevel", 2 ); if($level>=$minLevel){ - $datadir=OC_Config::getValue( "datadirectory", OC::$SERVERROOT.'/data' ); - $logFile=OC_Config::getValue( "logfile", $datadir.'/owncloud.log' ); $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level,'time'=>time()); - $fh=fopen($logFile, 'a'); + $fh=fopen(self::$logFile, 'a'); fwrite($fh, json_encode($entry)."\n"); fclose($fh); } @@ -58,10 +60,9 @@ class OC_Log_Owncloud { * @return array */ public static function getEntries($limit=50, $offset=0){ - $datadir=OC_Config::getValue( "datadirectory", OC::$SERVERROOT.'/data' ); - $logFile=OC_Config::getValue( "logfile", $datadir.'/owncloud.log' ); + self::init(); $entries=array(); - if(!file_exists($logFile)) { + if(!file_exists(self::$logFile)) { return array(); } $contents=file($logFile); |