Skip to content
Snippets Groups Projects
Commit d1a39ab0 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #4293 from owncloud/config-date

make log date configurable, default to iso 8601
parents b5f18111 33d78ab9
No related branches found
No related tags found
No related merge requests found
...@@ -188,5 +188,8 @@ $CONFIG = array( ...@@ -188,5 +188,8 @@ $CONFIG = array(
//links to custom clients //links to custom clients
'customclient_desktop' => '', //http://owncloud.org/sync-clients/ 'customclient_desktop' => '', //http://owncloud.org/sync-clients/
'customclient_android' => '', //https://play.google.com/store/apps/details?id=com.owncloud.android 'customclient_android' => '', //https://play.google.com/store/apps/details?id=com.owncloud.android
'customclient_ios' => '' //https://itunes.apple.com/us/app/owncloud/id543672169?mt=8 'customclient_ios' => '', //https://itunes.apple.com/us/app/owncloud/id543672169?mt=8
// date format to be used while writing to the owncloud logfile
'logdateformat' => 'F d, Y H:i:s'
); );
...@@ -44,12 +44,14 @@ class OC_Log_Owncloud { ...@@ -44,12 +44,14 @@ class OC_Log_Owncloud {
* write a message in the log * write a message in the log
* @param string $app * @param string $app
* @param string $message * @param string $message
* @param int level * @param int $level
*/ */
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) {
$time = date("F d, Y H:i:s", time()); // default to ISO8601
$format = OC_Config::getValue('logdateformat', 'c');
$time = date($format, time());
$entry=array('app'=>$app, 'message'=>$message, 'level'=>$level, 'time'=> $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) {
...@@ -61,8 +63,8 @@ class OC_Log_Owncloud { ...@@ -61,8 +63,8 @@ class OC_Log_Owncloud {
/** /**
* get entries from the log in reverse chronological order * get entries from the log in reverse chronological order
* @param int limit * @param int $limit
* @param int offset * @param int $offset
* @return array * @return array
*/ */
public static function getEntries($limit=50, $offset=0) { public static function getEntries($limit=50, $offset=0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment