Oolite 1.91.0.7646-241128-10e222e
Loading...
Searching...
No Matches
OOLogging.h File Reference
import "OOCocoa.h"
import "OOFunctionAttributes.h"
#include <stdarg.h>
+ Include dependency graph for OOLogging.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define OOLog(class, format, ...)
 
#define OOLogWithArguments(class, format, args)
 
#define OOLogIndentIf(class)
 
#define OOLogOutdentIf(class)
 
#define OOLOG_ERROR_PREFIX   @"***** ERROR: "
 
#define OOLOG_WARNING_PREFIX   @"----- WARNING: "
 
#define OOLogERR(class, format, ...)
 
#define OOLogWARN(class, format, ...)
 
#define OOLogGenericParameterError()
 
#define OOLogGenericSubclassResponsibility()
 
#define NSLog(format, ...)
 
#define NSLogv(format, args)
 
#define OODebugLog(class, format, ...)
 
#define OOExtraLog   OOLog
 

Functions

BOOL OOLogWillDisplayMessagesInClass (NSString *inMessageClass)
 
void OOLogIndent (void)
 
void OOLogOutdent (void)
 
void OOLogPushIndent (void)
 
void OOLogPopIndent (void)
 
void OOLogWithPrefix (NSString *inMessageClass, const char *inFunction, const char *inFile, unsigned long inLine, NSString *inPrefix, NSString *inFormat,...) OO_TAKES_FORMAT_STRING(6
 
void void OOLogWithFunctionFileAndLine (NSString *inMessageClass, const char *inFunction, const char *inFile, unsigned long inLine, NSString *inFormat,...) OO_TAKES_FORMAT_STRING(5
 
void void void OOLogWithFunctionFileAndLineAndArguments (NSString *inMessageClass, const char *inFunction, const char *inFile, unsigned long inLine, NSString *inFormat, va_list inArguments) OO_TAKES_FORMAT_STRING(5
 
void OOLogGenericParameterErrorForFunction (const char *inFunction)
 
void OOLogGenericSubclassResponsibilityForFunction (const char *inFunction)
 

Variables

NSString *const kOOLogSubclassResponsibility
 
NSString *const kOOLogParameterError
 
NSString *const kOOLogDeprecatedMethod
 
NSString *const kOOLogAllocationFailure
 
NSString *const kOOLogInconsistentState
 
NSString *const kOOLogException
 
NSString *const kOOLogFileNotFound
 
NSString *const kOOLogFileNotLoaded
 
NSString *const kOOLogOpenGLError
 
NSString *const kOOLogUnconvertedNSLog
 

Macro Definition Documentation

◆ NSLog

#define NSLog ( format,
... )
Value:
OOLog(kOOLogUnconvertedNSLog, format, ## __VA_ARGS__)
#define OOLog(class, format,...)
Definition OOLogging.h:88
NSString *const kOOLogUnconvertedNSLog
Definition OOLogging.m:655

Definition at line 137 of file OOLogging.h.

Referenced by DirectoryExistCreatingIfNecessary().

◆ NSLogv

#define NSLogv ( format,
args )
Value:
#define OOLogWithArguments(class, format, args)
Definition OOLogging.h:89

Definition at line 138 of file OOLogging.h.

◆ OODebugLog

#define OODebugLog ( class,
format,
... )
Value:
do { (void)class; if (0) (void)format; } while (0)

Definition at line 146 of file OOLogging.h.

◆ OOExtraLog

#define OOExtraLog   OOLog

Definition at line 152 of file OOLogging.h.

Referenced by Universe::addEntity:.

◆ OOLog

#define OOLog ( class,
format,
... )
Value:
do { if (OOLogWillDisplayMessagesInClass(class)) { OOLogWithFunctionFileAndLine(class, OOLOG_FUNCTION_NAME, OOLOG_FILE_NAME, __LINE__, format, ## __VA_ARGS__); }} while (0)
BOOL OOLogWillDisplayMessagesInClass(NSString *inMessageClass)
Definition OOLogging.m:144
void void OOLogWithFunctionFileAndLine(NSString *inMessageClass, const char *inFunction, const char *inFile, unsigned long inLine, NSString *inFormat,...) OO_TAKES_FORMAT_STRING(5

Definition at line 88 of file OOLogging.h.

Referenced by OOMeshToOctreeConverter::addTriangle:, OOConcreteTexture::apply, CacheRemoveOldest(), CanonicalizeMaterialSpecifier(), ClassifyLHSConditionSelector(), AI::clearAllData, NSFileManager(OOExtensions)::commanderContentsOfPath:, CompileSystemDescriptions(), NSString(OOJavaScriptExtensions)::concatenationOfStringsFromJavaScriptValues:count:separator:inContext:, CopyDataFromFile(), OOScript::descriptionComponents, DumpVariable(), ErrorCallback(), ExportSystemDescriptions(), fillSquareImageDataWithCloudTexture(), FloatRGBFromDictColor(), TextureStore::getCloudTextureNameFor:color:impress:intoData:width:height:, GetShaderSource(), GLDumpCullingState(), GLDumpFogState(), GLDumpLightState(), GLDumpMaterialState(), GLDumpStateFlags(), GlobalLog(), NSThread(MethodsThatMayExistDependingOnSystem)::isMainThread, KeyToIndex(), LogOpenGLState(), main(), MissionRunCallback(), OOCheckOpenGLErrors(), OOCPUInfoInit(), OOGenerateMipMaps(), OOInterpretTextureSpecifier(), OOJSBeginProfiling(), OOJSDumpStack(), OOJSEndProfiling(), OOJSProfileEnter(), OOJSStartTimeLimiterWithTimeLimit_(), OOJSStopTimeLimiter_(), OOJSUnreachable(), OOLogGenericParameterErrorForFunction(), OOLogGenericSubclassResponsibilityForFunction(), OOLogOutputHandlerInit(), OOPrintLogHeader(), OOPropertyListFromData(), OORandomPositionInCylinder(), OOSanitizeLegacyScriptConditionsInternal(), OOSanitizeLegacyScriptInternal(), OOStandardsInternal(), PNGError(), PNGWarning(), RemoveCallbackAtIndex(), ReportJSError(), SanitizeActionStatement(), SanitizeCondition(), SanitizeConditionalStatement(), SwitchLogFile(), TessVertexCallback(), TreeInsert(), TreeSplay(), ValueIfClass(), Universe::VerifyDescString, and VerifyOpenGLStateInternal().

◆ OOLOG_ERROR_PREFIX

#define OOLOG_ERROR_PREFIX   @"***** ERROR: "

Definition at line 109 of file OOLogging.h.

◆ OOLOG_WARNING_PREFIX

#define OOLOG_WARNING_PREFIX   @"----- WARNING: "

Definition at line 110 of file OOLogging.h.

◆ OOLogERR

#define OOLogERR ( class,
format,
... )
Value:
OOLogWithPrefix(class, OOLOG_FUNCTION_NAME, OOLOG_FILE_NAME, __LINE__, OOLOG_ERROR_PREFIX ,format, ## __VA_ARGS__)
void OOLogWithPrefix(NSString *inMessageClass, const char *inFunction, const char *inFile, unsigned long inLine, NSString *inPrefix, NSString *inFormat,...) OO_TAKES_FORMAT_STRING(6
#define OOLOG_ERROR_PREFIX
Definition OOLogging.h:109

Definition at line 112 of file OOLogging.h.

Referenced by ApplyOneOperator(), AI::clearAllData, NSFileManager(OOExtensions)::commanderContentsOfPath:, Universe::coordinatesForSystem:, OOScript::descriptionComponents, ExpandDigitKey(), ExpandStringKeyFromDescriptions(), main(), OperationCallback(), RandomSeedFromString(), ScanQuaternionFromString(), ScanVectorAndQuaternionFromString(), and ScanVectorFromString().

◆ OOLogGenericParameterError

#define OOLogGenericParameterError ( )
Value:
void OOLogGenericParameterErrorForFunction(const char *inFunction)
Definition OOLogging.m:495

Definition at line 125 of file OOLogging.h.

Referenced by EnsureCorrectDataSize(), EntityFromArgumentList(), and OOScalePixMap().

◆ OOLogGenericSubclassResponsibility

#define OOLogGenericSubclassResponsibility ( )
Value:
void OOLogGenericSubclassResponsibilityForFunction(const char *inFunction)
Definition OOLogging.m:501

Definition at line 129 of file OOLogging.h.

◆ OOLogIndentIf

#define OOLogIndentIf ( class)
Value:
do { if (OOLogWillDisplayMessagesInClass(class)) OOLogIndent(); } while (0)
void OOLogIndent(void)
Definition OOLogging.m:366

Definition at line 101 of file OOLogging.h.

Referenced by OOScript::descriptionComponents.

◆ OOLogOutdentIf

#define OOLogOutdentIf ( class)
Value:
do { if (OOLogWillDisplayMessagesInClass(class)) OOLogOutdent(); } while (0)
void OOLogOutdent(void)
Definition OOLogging.m:376

Definition at line 102 of file OOLogging.h.

Referenced by OOScript::descriptionComponents.

◆ OOLogWARN

#define OOLogWARN ( class,
format,
... )
Value:
OOLogWithPrefix(class, OOLOG_FUNCTION_NAME, OOLOG_FILE_NAME, __LINE__, OOLOG_WARNING_PREFIX, format, ## __VA_ARGS__)
#define OOLOG_WARNING_PREFIX
Definition OOLogging.h:110

Definition at line 113 of file OOLogging.h.

Referenced by OOInterpretTextureSpecifier(), OOLookUpPluralDescriptionPRIV(), RunDeferredOperations(), and TimerFinalize().

◆ OOLogWithArguments

#define OOLogWithArguments ( class,
format,
args )
Value:
do { if (OOLogWillDisplayMessagesInClass(class)) { OOLogWithFunctionFileAndLineAndArguments(class, OOLOG_FUNCTION_NAME, OOLOG_FILE_NAME, __LINE__, format, args); }} while (0)
void void void OOLogWithFunctionFileAndLineAndArguments(NSString *inMessageClass, const char *inFunction, const char *inFile, unsigned long inLine, NSString *inFormat, va_list inArguments) OO_TAKES_FORMAT_STRING(5

Definition at line 89 of file OOLogging.h.

Function Documentation

◆ OOLogGenericParameterErrorForFunction()

void OOLogGenericParameterErrorForFunction ( const char * inFunction)

Definition at line 495 of file OOLogging.m.

496{
497 OOLog(kOOLogParameterError, @"***** %s: bad parameters. (This is an internal programming error, please report it.)", inFunction);
498}
NSString *const kOOLogParameterError
Definition OOLogging.m:647

References kOOLogParameterError, and OOLog.

◆ OOLogGenericSubclassResponsibilityForFunction()

void OOLogGenericSubclassResponsibilityForFunction ( const char * inFunction)

Definition at line 501 of file OOLogging.m.

502{
503 OOLog(kOOLogSubclassResponsibility, @"***** %s is a subclass responsibility. (This is an internal programming error, please report it.)", inFunction);
504}
NSString *const kOOLogSubclassResponsibility
Definition OOLogging.m:646

References kOOLogSubclassResponsibility, and OOLog.

◆ OOLogIndent()

void OOLogIndent ( void )

Definition at line 366 of file OOLogging.m.

367{
368 INDENT_LOCK();
369
371
373}
OOINLINE unsigned GetIndentLevel(void) PURE_FUNC
Definition OOLogging.m:302
OOINLINE void SetIndentLevel(unsigned level)
Definition OOLogging.m:309
#define INDENT_LOCK()
Definition OOLogging.m:298
#define INDENT_UNLOCK()
Definition OOLogging.m:299

References GetIndentLevel(), INDENT_LOCK, INDENT_UNLOCK, and SetIndentLevel().

Referenced by GLDumpCullingState(), GLDumpFogState(), GLDumpLightState(), GLDumpMaterialState(), GLDumpStateFlags(), LogOpenGLState(), OOCheckOpenGLErrors(), OOJSBeginProfiling(), OOJSProfileEnter(), and VerifyOpenGLStateInternal().

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

◆ OOLogOutdent()

void OOLogOutdent ( void )

Definition at line 376 of file OOLogging.m.

377{
378 INDENT_LOCK();
379
380 unsigned indentLevel = GetIndentLevel();
381 if (indentLevel != 0) SetIndentLevel(indentLevel - 1);
382
384}

References GetIndentLevel(), INDENT_LOCK, INDENT_UNLOCK, and SetIndentLevel().

Referenced by OOTimeProfileEntry(Private)::addSampleWithTotalTime:selfTime:, GLDumpCullingState(), GLDumpFogState(), GLDumpLightState(), GLDumpMaterialState(), GLDumpStateFlags(), LogOpenGLState(), OOCheckOpenGLErrors(), OOJSEndProfiling(), and VerifyOpenGLStateInternal().

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

◆ OOLogPopIndent()

void OOLogPopIndent ( void )

Definition at line 340 of file OOLogging.m.

341{
342 OOLogIndentStackElement *elem = NULL;
343 NSMutableDictionary *threadDict = nil;
344 NSValue *val = nil;
345
346 threadDict = [[NSThread currentThread] threadDictionary];
347 val = [threadDict objectForKey:kIndentStackKey];
348
349 elem = [val pointerValue];
350
351 if (elem != NULL)
352 {
353 [threadDict setObject:[NSNumber numberWithUnsignedInt:elem->indent] forKey:kIndentLevelKey];
354 [threadDict setObject:[NSValue valueWithPointer:elem->link] forKey:kIndentStackKey];
355 free(elem);
356 }
357 else
358 {
359 OOLogInternal(OOLOG_BAD_POP_INDENT, @"OOLogPopIndent(): state stack underflow.");
360 }
361}
static NSString *const kIndentStackKey
Definition OOLogging.m:53
#define OOLogInternal(cond, format,...)
Definition OOLogging.m:106
static NSString *const kIndentLevelKey
Definition OOLogging.m:52
#define OOLOG_BAD_POP_INDENT
Definition OOLogging.m:68
return nil
OOLogIndentStackElement * link
Definition OOLogging.m:76

References nil, OOLOG_BAD_POP_INDENT, and OOLogInternal.

◆ OOLogPushIndent()

void OOLogPushIndent ( void )

Definition at line 316 of file OOLogging.m.

317{
318 OOLogIndentStackElement *elem = NULL;
319 NSMutableDictionary *threadDict = nil;
320 NSValue *val = nil;
321
322 elem = malloc(sizeof *elem);
323 if (elem != NULL)
324 {
325 threadDict = [[NSThread currentThread] threadDictionary];
326 val = [threadDict objectForKey:kIndentStackKey];
327
328 elem->indent = [[threadDict objectForKey:kIndentLevelKey] intValue];
329 elem->link = [val pointerValue];
330
331 /*
332 Clang static analyzer reports elem not released here. It is in fact
333 released in OOLogPopIndent().
334 */
335 [threadDict setObject:[NSValue valueWithPointer:elem] forKey:kIndentStackKey];
336 }
337}

References OOLogIndentStackElement::indent, OOLogIndentStackElement::link, and nil.

◆ OOLogWillDisplayMessagesInClass()

BOOL OOLogWillDisplayMessagesInClass ( NSString * inMessageClass)

Definition at line 144 of file OOLogging.m.

145{
146 id value = nil;
147
148 if (!Inited()) return NO;
149
151
152 [sLock lock];
153
154 // Look for cached value
155 value = [sDerivedSettingsCache objectForKey:inMessageClass];
156 if (EXPECT_NOT(value == nil))
157 {
158 @try
159 {
160 // No cached value.
161 value = ResolveDisplaySetting(inMessageClass);
162
163 if (value != nil)
164 {
165 if (EXPECT_NOT(sDerivedSettingsCache == nil)) sDerivedSettingsCache = [[NSMutableDictionary alloc] init];
166 [sDerivedSettingsCache setObject:value forKey:inMessageClass];
167 }
168 }
169 @catch (id exception)
170 {
171 [sLock unlock];
172 @throw exception;
173 }
174 }
175 [sLock unlock];
176
177 OOLogInternal(OOLOG_SETTING_RETRIEVE, @"%@ is %s", inMessageClass, (value == kTrueToken) ? "on" : "off");
178 return value == kTrueToken;
179}
#define EXPECT_NOT(x)
static NSString *const kTrueToken
Definition OOLogging.m:100
#define OOLOG_SETTING_RETRIEVE
Definition OOLogging.m:64
static BOOL sOverrideValue
Definition OOLogging.m:97
OOINLINE BOOL Inited(void)
Definition OOLogging.m:136
static NSLock * sLock
Definition OOLogging.m:83
static BOOL sOverrideInEffect
Definition OOLogging.m:96
static id ResolveDisplaySetting(NSString *inMessageClass)
Definition OOLogging.m:861
static NSMutableDictionary * sDerivedSettingsCache
Definition OOLogging.m:85

References EXPECT_NOT, Inited(), kTrueToken, nil, OOLOG_SETTING_RETRIEVE, OOLogInternal, ResolveDisplaySetting(), sDerivedSettingsCache, sOverrideInEffect, and sOverrideValue.

Referenced by ConsoleDisplayMessagesInClass(), GlobalLog(), LogOpenGLState(), OOCheckOpenGLErrors(), OOLogWithFunctionFileAndLineAndArguments(), OOLogWithPrefix(), OONSLogCStringFunction(), ReportJSError(), SyntaxIssue(), and VerifyOpenGLStateInternal().

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

◆ OOLogWithFunctionFileAndLine()

void void OOLogWithFunctionFileAndLine ( NSString * inMessageClass,
const char * inFunction,
const char * inFile,
unsigned long inLine,
NSString * inFormat,
... )

Referenced by OONSLogCStringFunction().

+ Here is the caller graph for this function:

◆ OOLogWithFunctionFileAndLineAndArguments()

void void void OOLogWithFunctionFileAndLineAndArguments ( NSString * inMessageClass,
const char * inFunction,
const char * inFile,
unsigned long inLine,
NSString * inFormat,
va_list inArguments )

Referenced by SyntaxIssue().

+ Here is the caller graph for this function:

◆ OOLogWithPrefix()

void OOLogWithPrefix ( NSString * inMessageClass,
const char * inFunction,
const char * inFile,
unsigned long inLine,
NSString * inPrefix,
NSString * inFormat,
... )

Variable Documentation

◆ kOOLogAllocationFailure

NSString* const kOOLogAllocationFailure
extern

Definition at line 649 of file OOLogging.m.

Referenced by OOMeshToOctreeConverter::addTriangle:.

◆ kOOLogDeprecatedMethod

NSString* const kOOLogDeprecatedMethod
extern

Definition at line 648 of file OOLogging.m.

◆ kOOLogException

NSString* const kOOLogException
extern

Definition at line 651 of file OOLogging.m.

Referenced by AI::clearAllData, main(), MissionRunCallback(), and OOJSDumpStack().

◆ kOOLogFileNotFound

NSString* const kOOLogFileNotFound
extern

Definition at line 652 of file OOLogging.m.

Referenced by CopyDataFromFile(), and GetShaderSource().

◆ kOOLogFileNotLoaded

NSString* const kOOLogFileNotLoaded
extern

Definition at line 653 of file OOLogging.m.

◆ kOOLogInconsistentState

NSString* const kOOLogInconsistentState
extern

Definition at line 650 of file OOLogging.m.

◆ kOOLogOpenGLError

NSString* const kOOLogOpenGLError
extern

Definition at line 654 of file OOLogging.m.

Referenced by OOCheckOpenGLErrors().

◆ kOOLogParameterError

NSString* const kOOLogParameterError
extern

◆ kOOLogSubclassResponsibility

NSString* const kOOLogSubclassResponsibility
extern

Definition at line 646 of file OOLogging.m.

Referenced by OOLogGenericSubclassResponsibilityForFunction().

◆ kOOLogUnconvertedNSLog

NSString* const kOOLogUnconvertedNSLog
extern

Definition at line 655 of file OOLogging.m.