Enabled logging of time of events' occurence in the format hh:mm:ss.mil. This is controlled by setting the key 'logging-show-time' to YES/NO in the preferences file.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@3765 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
9838e68a1c
commit
dcf1e04e22
@ -24,9 +24,11 @@ _OOLogInsertMarker
|
||||
_OOLogSetDisplayMessagesInClass
|
||||
_OOLogSetShowFileAndLine
|
||||
_OOLogSetShowFunction
|
||||
_OOLogSetShowTime
|
||||
_OOLogSetShowMessageClass
|
||||
_OOLogShowFileAndLine
|
||||
_OOLogShowFunction
|
||||
_OOLogShowTime
|
||||
_OOLogShowMessageClass
|
||||
_OOLogWillDisplayMessagesInClass
|
||||
_OOLogHandlerGetLogPath
|
||||
|
@ -19,9 +19,11 @@ _OOLogInsertMarker
|
||||
_OOLogSetDisplayMessagesInClass
|
||||
_OOLogSetShowFileAndLine
|
||||
_OOLogSetShowFunction
|
||||
_OOLogSetShowTime
|
||||
_OOLogSetShowMessageClass
|
||||
_OOLogShowFileAndLine
|
||||
_OOLogShowFunction
|
||||
_OOLogShowTime
|
||||
_OOLogShowMessageClass
|
||||
_OOLogWillDisplayMessagesInClass
|
||||
_OOLogHandlerGetLogPath
|
||||
|
@ -94,6 +94,7 @@ static THREAD_LOCAL OOLogIndentStackElement
|
||||
#endif
|
||||
static BOOL sShowFunction = NO;
|
||||
static BOOL sShowFileAndLine = NO;
|
||||
static BOOL sShowTime = NO;
|
||||
static BOOL sShowClass = YES;
|
||||
static BOOL sDefaultDisplay = YES;
|
||||
static BOOL sOverrideInEffect = NO;
|
||||
@ -451,6 +452,11 @@ void OOLogWithFunctionFileAndLineAndArguments(NSString *inMessageClass, const ch
|
||||
}
|
||||
}
|
||||
|
||||
if (sShowTime)
|
||||
{
|
||||
formattedMessage = [NSString stringWithFormat:@"%@ %@", [[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S.%F" timeZone:nil locale:nil], formattedMessage];
|
||||
}
|
||||
|
||||
// Apply indentation
|
||||
indentLevel = GetIndentLevel();
|
||||
if (indentLevel != 0)
|
||||
@ -528,6 +534,24 @@ void OOLogSetShowFileAndLine(BOOL flag)
|
||||
}
|
||||
|
||||
|
||||
BOOL OOLogShowTime(void)
|
||||
{
|
||||
return sShowTime;
|
||||
}
|
||||
|
||||
|
||||
void OOLogSetShowTime(BOOL flag)
|
||||
{
|
||||
flag = !!flag; // YES or NO, not 42.
|
||||
|
||||
if (flag != sShowTime)
|
||||
{
|
||||
sShowTime = flag;
|
||||
[[NSUserDefaults standardUserDefaults] setBool:flag forKey:@"logging-show-time"];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BOOL OOLogShowMessageClass(void)
|
||||
{
|
||||
return sShowClass;
|
||||
@ -719,6 +743,7 @@ static void LoadExplicitSettings(void)
|
||||
// Load display settings
|
||||
sShowFunction = [prefs oo_boolForKey:@"logging-show-function" defaultValue:sShowFunction];
|
||||
sShowFileAndLine = [prefs oo_boolForKey:@"logging-show-file-and-line" defaultValue:sShowFileAndLine];
|
||||
sShowTime = [prefs oo_boolForKey:@"logging-show-time" defaultValue:sShowTime];
|
||||
sShowClass = [prefs oo_boolForKey:@"logging-show-class" defaultValue:sShowClass];
|
||||
|
||||
OOLogInternal(OOLOG_SETTING_SET, @"Settings: %@", sExplicitSettings);
|
||||
|
@ -47,6 +47,8 @@ BOOL OOLogShowFunction(void);
|
||||
void OOLogSetShowFunction(BOOL flag);
|
||||
BOOL OOLogShowFileAndLine(void);
|
||||
void OOLogSetShowFileAndLine(BOOL flag);
|
||||
BOOL OOLogShowTime(void);
|
||||
void OOLogSetShowTime(BOOL flag);
|
||||
BOOL OOLogShowMessageClass(void);
|
||||
void OOLogSetShowMessageClass(BOOL flag);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user