diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-04-16 12:21:12 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-04-16 12:21:48 +0200 |
commit | 5720bd296dbd5f0459ea53c12d488999193801da (patch) | |
tree | 6bb24f9174ee5db421f3a0d0c4d635ecc00d983b /lib | |
parent | 70d0103a675fca4896974f1d59f5e76365304159 (diff) | |
download | nextcloud-server-5720bd296dbd5f0459ea53c12d488999193801da.tar.gz nextcloud-server-5720bd296dbd5f0459ea53c12d488999193801da.zip |
merge log into admin
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/app.php | 2 | ||||
-rw-r--r-- | lib/log/owncloud.php | 12 | ||||
-rw-r--r-- | lib/util.php | 34 |
3 files changed, 26 insertions, 22 deletions
diff --git a/lib/app.php b/lib/app.php index bd432109b23..9f7d23872f3 100755 --- a/lib/app.php +++ b/lib/app.php @@ -303,8 +303,6 @@ class OC_App{ $settings[] = array( "id" => "core_users", "order" => 2, "href" => OC_Helper::linkTo( "settings", "users.php" ), "name" => $l->t("Users"), "icon" => OC_Helper::imagePath( "settings", "users.svg" )); // admin apps menu $settings[] = array( "id" => "core_apps", "order" => 3, "href" => OC_Helper::linkTo( "settings", "apps.php" ).'?installed', "name" => $l->t("Apps"), "icon" => OC_Helper::imagePath( "settings", "apps.svg" )); - // admin log menu - $settings[] = array( "id" => "core_log", "order" => 4, "href" => OC_Helper::linkTo( "settings", "log.php" ), "name" => $l->t("Log"), "icon" => OC_Helper::imagePath( "settings", "log.svg" )); $settings[]=array( "id" => "admin", "order" => 1000, "href" => OC_Helper::linkTo( "settings", "admin.php" ), "name" => $l->t("Admin"), "icon" => OC_Helper::imagePath( "settings", "admin.svg" )); } diff --git a/lib/log/owncloud.php b/lib/log/owncloud.php index 0ed30510134..881c67d2664 100644 --- a/lib/log/owncloud.php +++ b/lib/log/owncloud.php @@ -44,7 +44,7 @@ class OC_Log_Owncloud { * @param int level */ public static function write($app, $message, $level) { - $minLevel=OC_Config::getValue( "loglevel", 2 ); + $minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ),OC_Log::ERROR); if($level>=$minLevel){ $entry=array('app'=>$app, 'message'=>$message, 'level'=>$level,'time'=>time()); $fh=fopen(self::$logFile, 'a'); @@ -61,6 +61,7 @@ class OC_Log_Owncloud { */ public static function getEntries($limit=50, $offset=0){ self::init(); + $minLevel=OC_Config::getValue( "loglevel", OC_Log::WARN ); $entries=array(); if(!file_exists(self::$logFile)) { return array(); @@ -71,8 +72,13 @@ class OC_Log_Owncloud { } $end=max(count($contents)-$offset-1, 0); $start=max($end-$limit,0); - for($i=$end;$i>$start;$i--) { - $entries[]=json_decode($contents[$i]); + $i=$end; + while(count($entries)<$limit){ + $entry=json_decode($contents[$i]); + if($entry->level>=$minLevel){ + $entries[]=$entry; + } + $i--; } return $entries; } diff --git a/lib/util.php b/lib/util.php index 2ea392ec31d..02ac2e505fa 100644 --- a/lib/util.php +++ b/lib/util.php @@ -129,23 +129,23 @@ class OC_Util { self::$headers[]=array('tag'=>$tag,'attributes'=>$attributes,'text'=>$text); } - /** - * formats a timestamp in the "right" way - * - * @param int timestamp $timestamp - * @param bool dateOnly option to ommit time from the result - */ - public static function formatDate( $timestamp,$dateOnly=false){ - if(isset($_SESSION['timezone'])){//adjust to clients timezone if we know it - $systemTimeZone = intval(date('O')); - $systemTimeZone=(round($systemTimeZone/100,0)*60)+($systemTimeZone%100); - $clientTimeZone=$_SESSION['timezone']*60; - $offset=$clientTimeZone-$systemTimeZone; - $timestamp=$timestamp+$offset*60; - } - $timeformat=$dateOnly?'F j, Y':'F j, Y, H:i'; - return date($timeformat,$timestamp); - } + /** + * formats a timestamp in the "right" way + * + * @param int timestamp $timestamp + * @param bool dateOnly option to ommit time from the result + */ + public static function formatDate( $timestamp,$dateOnly=false){ + if(isset($_SESSION['timezone'])){//adjust to clients timezone if we know it + $systemTimeZone = intval(date('O')); + $systemTimeZone=(round($systemTimeZone/100,0)*60)+($systemTimeZone%100); + $clientTimeZone=$_SESSION['timezone']*60; + $offset=$clientTimeZone-$systemTimeZone; + $timestamp=$timestamp+$offset*60; + } + $timeformat=$dateOnly?'F j, Y':'F j, Y, H:i'; + return date($timeformat,$timestamp); + } /** * Shows a pagenavi widget where you can jump to different pages. |