Merge pull request #2975 from owncloud/log-date

use date and time instead of timestamp in log
This commit is contained in:
Morris Jobke 2013-04-17 06:49:46 -07:00
commit 867a527148
3 changed files with 12 additions and 3 deletions

View File

@ -49,7 +49,8 @@ class OC_Log_Owncloud {
public static function write($app, $message, $level) { public static function write($app, $message, $level) {
$minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ), OC_Log::ERROR); $minLevel=min(OC_Config::getValue( "loglevel", OC_Log::WARN ), OC_Log::ERROR);
if($level>=$minLevel) { if($level>=$minLevel) {
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=>time()); $time = date("F d, Y H:i:s", time());
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $time);
$handle = @fopen(self::$logFile, 'a'); $handle = @fopen(self::$logFile, 'a');
if ($handle) { if ($handle) {
fwrite($handle, json_encode($entry)."\n"); fwrite($handle, json_encode($entry)."\n");

View File

@ -55,7 +55,11 @@ OC.Log={
row.append(messageTd); row.append(messageTd);
var timeTd=$('<td/>'); var timeTd=$('<td/>');
if(isNaN(entry.time)){
timeTd.text(entry.time);
} else {
timeTd.text(formatDate(entry.time*1000)); timeTd.text(formatDate(entry.time*1000));
}
row.append(timeTd); row.append(timeTd);
$('#log').append(row); $('#log').append(row);
} }

View File

@ -214,7 +214,11 @@ endfor;?>
<?php p($entry->message);?> <?php p($entry->message);?>
</td> </td>
<td> <td>
<?php p(OC_Util::formatDate($entry->time));?> <?php if(is_int($entry->time)){
p(OC_Util::formatDate($entry->time));
} else {
p($entry->time);
}?>
</td> </td>
</tr> </tr>
<?php endforeach;?> <?php endforeach;?>