Oolite 1.91.0.7645-241119-222d325
Loading...
Searching...
No Matches
OOLoggingExtended.h File Reference
import "OOLogging.h"
+ Include dependency graph for OOLoggingExtended.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void OOLogSetDisplayMessagesInClass (NSString *inClass, BOOL inFlag)
 
NSString * OOLogGetParentMessageClass (NSString *inClass)
 
void OOLoggingInit (void)
 
void OOLoggingTerminate (void)
 
void OOLogInsertMarker (void)
 
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)
 
void OOLogSetShowMessageClassTemporary (BOOL flag)
 
NSString * OOLogAbbreviatedFileName (const char *inName)
 

Function Documentation

◆ OOLogAbbreviatedFileName()

NSString * OOLogAbbreviatedFileName ( const char * inName)

Definition at line 839 of file OOLogging.m.

840{
841 NSString *name = nil;
842
843 if (EXPECT_NOT(inName == NULL)) return @"unspecified file";
844
845 [sLock lock];
846 name = NSMapGet(sFileNamesCache, inName);
847 if (EXPECT_NOT(name == nil))
848 {
849 name = [[NSString stringWithUTF8String:inName] lastPathComponent];
850 NSMapInsertKnownAbsent(sFileNamesCache, inName, name);
851 }
852 [sLock unlock];
853
854 return name;
855}
#define EXPECT_NOT(x)
static NSLock * sLock
Definition OOLogging.m:83
static NSMapTable * sFileNamesCache
Definition OOLogging.m:121
return nil

References EXPECT_NOT, nil, and sFileNamesCache.

Referenced by OOJSStopTimeLimiter_(), and OOJSUnreachable().

+ Here is the caller graph for this function:

◆ OOLogGetParentMessageClass()

NSString * OOLogGetParentMessageClass ( NSString * inClass)

Definition at line 207 of file OOLogging.m.

208{
209 NSRange range;
210
211 if (inClass == nil) return nil;
212
213 range = [inClass rangeOfString:@"." options:NSCaseInsensitiveSearch | NSLiteralSearch | NSBackwardsSearch]; // Only NSBackwardsSearch is important, others are optimizations
214 if (range.location == NSNotFound) return nil;
215
216 return [inClass substringToIndex:range.location];
217}

References nil.

Referenced by ResolveDisplaySetting().

+ Here is the caller graph for this function:

◆ OOLoggingInit()

void OOLoggingInit ( void )

Definition at line 585 of file OOLogging.m.

586{
587 NSAutoreleasePool *pool = nil;
588
589 if (sInited) return;
590
591 pool = [[NSAutoreleasePool alloc] init];
592
593 sLock = [[NSLock alloc] init];
594 [sLock setName:@"OOLogging lock"];
595 if (sLock == nil) exit(EXIT_FAILURE);
596
597#ifndef OOLOG_NO_FILE_NAME
598 sFileNamesCache = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks, NSObjectMapValueCallBacks, 100);
599#endif
600
601 sInited = YES; // Must be before OOLogOutputHandlerInit().
603
605
607
608 [pool release];
609}
void OOPrintLogHeader(void)
Definition OOLogHeader.m:60
void OOLogOutputHandlerInit(void)
static void LoadExplicitSettings(void)
Definition OOLogging.m:705
static BOOL sInited
Definition OOLogging.m:82

References LoadExplicitSettings(), nil, OOLogOutputHandlerInit(), OOPrintLogHeader(), sFileNamesCache, sInited, and sLock.

Referenced by main(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OOLoggingTerminate()

void OOLoggingTerminate ( void )

Definition at line 612 of file OOLogging.m.

613{
614 if (!sInited) return;
615
617
618 /* We do not set sInited to NO. Instead, the output handler is required
619 to be able to handle working even after being closed. Under OS X, this
620 is done by writing to stderr in this case; on other platforms, NSLog()
621 is used and OOLogOutputHandlerClose() is a no-op.
622 */
623}
void OOLogOutputHandlerClose(void)

References OOLogOutputHandlerClose(), and sInited.

+ Here is the call graph for this function:

◆ OOLogInsertMarker()

void OOLogInsertMarker ( void )

Definition at line 632 of file OOLogging.m.

633{
634 static unsigned lastMarkerID = 0;
635 unsigned thisMarkerID;
636 NSString *marker = nil;
637
638 [sLock lock];
639 thisMarkerID = ++lastMarkerID;
640 [sLock unlock];
641
642 marker = [NSString stringWithFormat:@"\n\n========== [Marker %u] ==========", thisMarkerID];
644}
void OOLogOutputHandlerPrint(NSString *string)

References nil, and OOLogOutputHandlerPrint().

Referenced by ConsoleWriteLogMarker().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OOLogSetDisplayMessagesInClass()

void OOLogSetDisplayMessagesInClass ( NSString * inClass,
BOOL inFlag )

Definition at line 182 of file OOLogging.m.

183{
184 id value = nil;
185
186 if (!Inited()) return;
187
188 [sLock lock];
189 value = [sExplicitSettings objectForKey:inClass];
190 if (value == nil || value != CacheValue(inFlag))
191 {
192 OOLogInternal(OOLOG_SETTING_SET, @"Setting %@ to %s", inClass, inFlag ? "ON" : "OFF");
193
194 [sExplicitSettings setObject:CacheValue(inFlag) forKey:inClass];
195
196 // Clear cache and let it be rebuilt as needed.
198 }
199 else
200 {
201 OOLogInternal(OOLOG_SETTING_SET, @"Keeping %@ %s", inClass, inFlag ? "ON" : "OFF");
202 }
203 [sLock unlock];
204}
#define DESTROY(x)
Definition OOCocoa.h:77
static NSMutableDictionary * sExplicitSettings
Definition OOLogging.m:84
OOINLINE BOOL Inited(void)
Definition OOLogging.m:136
#define OOLOG_SETTING_SET
Definition OOLogging.m:63
#define OOLogInternal(cond, format,...)
Definition OOLogging.m:106
OOINLINE id CacheValue(BOOL inValue) PURE_FUNC
Definition OOLogging.m:127
static NSMutableDictionary * sDerivedSettingsCache
Definition OOLogging.m:85

References CacheValue(), DESTROY, Inited(), nil, OOLOG_SETTING_SET, OOLogInternal, and sDerivedSettingsCache.

Referenced by ConsoleSetDisplayMessagesInClass().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OOLogSetShowFileAndLine()

void OOLogSetShowFileAndLine ( BOOL flag)

Definition at line 531 of file OOLogging.m.

532{
533 flag = !!flag; // YES or NO, not 42.
534
535 if (flag != sShowFileAndLine)
536 {
537 sShowFileAndLine = flag;
538 [[NSUserDefaults standardUserDefaults] setBool:flag forKey:@"logging-show-file-and-line"];
539 }
540}
static BOOL sShowFileAndLine
Definition OOLogging.m:92

References sShowFileAndLine.

◆ OOLogSetShowFunction()

void OOLogSetShowFunction ( BOOL flag)

Definition at line 513 of file OOLogging.m.

514{
515 flag = !!flag; // YES or NO, not 42.
516
517 if (flag != sShowFunction)
518 {
519 sShowFunction = flag;
520 [[NSUserDefaults standardUserDefaults] setBool:flag forKey:@"logging-show-function"];
521 }
522}
static BOOL sShowFunction
Definition OOLogging.m:91

References sShowFunction.

◆ OOLogSetShowMessageClass()

void OOLogSetShowMessageClass ( BOOL flag)

Definition at line 567 of file OOLogging.m.

568{
569 flag = !!flag; // YES or NO, not 42.
570
571 if (flag != sShowClass)
572 {
573 sShowClass = flag;
574 [[NSUserDefaults standardUserDefaults] setBool:flag forKey:@"logging-show-class"];
575 }
576}
static BOOL sShowClass
Definition OOLogging.m:94

References sShowClass.

◆ OOLogSetShowMessageClassTemporary()

void OOLogSetShowMessageClassTemporary ( BOOL flag)

Definition at line 579 of file OOLogging.m.

580{
581 sShowClass = !!flag; // YES or NO, not 42.
582}

References sShowClass.

◆ OOLogSetShowTime()

void OOLogSetShowTime ( BOOL flag)

Definition at line 549 of file OOLogging.m.

550{
551 flag = !!flag; // YES or NO, not 42.
552
553 if (flag != sShowTime)
554 {
555 sShowTime = flag;
556 [[NSUserDefaults standardUserDefaults] setBool:flag forKey:@"logging-show-time"];
557 }
558}
static BOOL sShowTime
Definition OOLogging.m:93

References sShowTime.

◆ OOLogShowFileAndLine()

BOOL OOLogShowFileAndLine ( void )

Definition at line 525 of file OOLogging.m.

526{
527 return sShowFileAndLine;
528}

References sShowFileAndLine.

◆ OOLogShowFunction()

BOOL OOLogShowFunction ( void )

Definition at line 507 of file OOLogging.m.

508{
509 return sShowFunction;
510}

References sShowFunction.

◆ OOLogShowMessageClass()

BOOL OOLogShowMessageClass ( void )

Definition at line 561 of file OOLogging.m.

562{
563 return sShowClass;
564}

References sShowClass.

◆ OOLogShowTime()

BOOL OOLogShowTime ( void )

Definition at line 543 of file OOLogging.m.

544{
545 return sShowTime;
546}

References sShowTime.