mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 01:31:08 +00:00
Improved logging.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@5139 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a8ce0b2efb
commit
7de0bc66f0
7 changed files with 75 additions and 11 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
Sun Nov 7 14:04:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
|
|
||||||
|
* Source/Foundation/NSDebug.h: Added NSWarnLog(), NSWarnFLog() and
|
||||||
|
NSWarnMLog() macros to log warnings about potential programming errors.
|
||||||
|
* Source/NSArray.m: Change to use NSWarnMLog() for warnings.
|
||||||
|
* Source/NSGArray.m: ditto
|
||||||
|
* Source/NSGCountedSet.m: ditto
|
||||||
|
* Source/NSGDictionary.m: ditto
|
||||||
|
* Source/NSGSet.m: ditto
|
||||||
|
|
||||||
Thu Nov 4 1999 Michael Hanni <mhanni@sprintmail.com>
|
Thu Nov 4 1999 Michael Hanni <mhanni@sprintmail.com>
|
||||||
|
|
||||||
* Source/NSObject.m: added FreeBSD specific code in
|
* Source/NSObject.m: added FreeBSD specific code in
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Interface to debugging utilities for GNUStep and OpenStep
|
/* Interface to debugging utilities for GNUStep and OpenStep
|
||||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
Copyright (C) 1997,1999 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||||
Date: August 1997
|
Date: August 1997
|
||||||
|
@ -72,6 +72,7 @@ extern NSString* GSDebugMethodMsg(id obj, SEL sel, const char *file,
|
||||||
int line, NSString *fmt);
|
int line, NSString *fmt);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Debug logging which can be enabled/disabled by defining DEBUG
|
/* Debug logging which can be enabled/disabled by defining DEBUG
|
||||||
when compiling and also setting values in the mutable array
|
when compiling and also setting values in the mutable array
|
||||||
|
@ -110,6 +111,7 @@ extern NSString* GSDebugMethodMsg(id obj, SEL sel, const char *file,
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#include <Foundation/NSObjCRuntime.h>
|
#include <Foundation/NSObjCRuntime.h>
|
||||||
#include <Foundation/NSProcessInfo.h>
|
#include <Foundation/NSProcessInfo.h>
|
||||||
|
|
||||||
#define NSDebugLLog(level, format, args...) \
|
#define NSDebugLLog(level, format, args...) \
|
||||||
do { if (GSDebugSet(level) == YES) \
|
do { if (GSDebugSet(level) == YES) \
|
||||||
NSLog(format, ## args); } while (0)
|
NSLog(format, ## args); } while (0)
|
||||||
|
@ -145,4 +147,51 @@ extern NSString* GSDebugMethodMsg(id obj, SEL sel, const char *file,
|
||||||
#define NSDebugMLog(format, args...)
|
#define NSDebugMLog(format, args...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Warning messages which can be enabled/disabled by defining GSWARN
|
||||||
|
when compiling.
|
||||||
|
|
||||||
|
These logging macros are intended to be used when the software detects
|
||||||
|
something that it not necessarily fatal or illegal, but looks like it
|
||||||
|
might be a programming error. eg. attempting to remove 'nil' from an
|
||||||
|
NSArray, which the Spec/documentation does not prohibit, but which a
|
||||||
|
well written progam should not be attempting (since an NSArray object
|
||||||
|
cannot contain a 'nil').
|
||||||
|
|
||||||
|
NB. The 'warn=yes' option is understood by the GNUstep make package
|
||||||
|
to mean that GSWARN should be defined, and the 'warn=no' means that
|
||||||
|
GSWARN should be undefined. Default is to define it.
|
||||||
|
|
||||||
|
To embed debug logging in your code you use the NSWarnLog() macro.
|
||||||
|
|
||||||
|
As a convenience, there are two more logging macros you can use -
|
||||||
|
NSWarnLog(), and NSWarnMLog().
|
||||||
|
These are specifically for use in either functions or methods and
|
||||||
|
prepend information about the file, line and either function or
|
||||||
|
class/method in which the message was generated.
|
||||||
|
|
||||||
|
*/
|
||||||
|
#ifdef GSWARN
|
||||||
|
#include <Foundation/NSObjCRuntime.h>
|
||||||
|
|
||||||
|
#define NSWarnLog(format, args...) \
|
||||||
|
do { \
|
||||||
|
NSLog(format, ## args); } while (0)
|
||||||
|
#define NSWarnFLog(format, args...) \
|
||||||
|
do { \
|
||||||
|
NSString *fmt = GSDebugFunctionMsg( \
|
||||||
|
__PRETTY_FUNCTION__, __FILE__, __LINE__, format); \
|
||||||
|
NSLog(fmt, ## args); } while (0)
|
||||||
|
#define NSWarnMLog(format, args...) \
|
||||||
|
do { \
|
||||||
|
NSString *fmt = GSDebugMethodMsg( \
|
||||||
|
self, _cmd, __FILE__, __LINE__, format); \
|
||||||
|
NSLog(fmt, ## args); } while (0)
|
||||||
|
#else
|
||||||
|
#define NSWarnLog(format, args...)
|
||||||
|
#define NSWarnFLog(format, args...)
|
||||||
|
#define NSWarnMLog(format, args...)
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <Foundation/NSUtilities.h>
|
#include <Foundation/NSUtilities.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSAutoreleasePool.h>
|
#include <Foundation/NSAutoreleasePool.h>
|
||||||
|
#include <Foundation/NSDebug.h>
|
||||||
|
|
||||||
#include <base/fast.x>
|
#include <base/fast.x>
|
||||||
|
|
||||||
|
@ -331,7 +332,7 @@ static SEL rlSel = @selector(removeLastObject);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NSLog(@"Contents of file does not contain an array");
|
NSWarnMLog(@"Contents of file does not contain an array", 0);
|
||||||
RELEASE(self);
|
RELEASE(self);
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
@ -881,7 +882,7 @@ static NSString *indentStrings[] = {
|
||||||
|
|
||||||
if (anObject == nil)
|
if (anObject == nil)
|
||||||
{
|
{
|
||||||
NSLog(@"attempt to remove nil object");
|
NSWarnMLog(@"attempt to remove nil object", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
i = [self count];
|
i = [self count];
|
||||||
|
@ -912,7 +913,7 @@ static NSString *indentStrings[] = {
|
||||||
|
|
||||||
if (anObject == nil)
|
if (anObject == nil)
|
||||||
{
|
{
|
||||||
NSLog(@"attempt to remove nil object");
|
NSWarnMLog(@"attempt to remove nil object", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
c = [self count];
|
c = [self count];
|
||||||
|
@ -951,7 +952,7 @@ static NSString *indentStrings[] = {
|
||||||
|
|
||||||
if (anObject == nil)
|
if (anObject == nil)
|
||||||
{
|
{
|
||||||
NSLog(@"attempt to remove nil object");
|
NSWarnMLog(@"attempt to remove nil object", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
c = [self count];
|
c = [self count];
|
||||||
|
@ -986,7 +987,7 @@ static NSString *indentStrings[] = {
|
||||||
|
|
||||||
if (anObject == nil)
|
if (anObject == nil)
|
||||||
{
|
{
|
||||||
NSLog(@"attempt to remove nil object");
|
NSWarnMLog(@"attempt to remove nil object", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
i = [self count];
|
i = [self count];
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include <base/behavior.h>
|
#include <base/behavior.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSPortCoder.h>
|
#include <Foundation/NSPortCoder.h>
|
||||||
|
#include <Foundation/NSDebug.h>
|
||||||
|
|
||||||
static SEL eqSel = @selector(isEqual:);
|
static SEL eqSel = @selector(isEqual:);
|
||||||
|
|
||||||
|
@ -425,7 +426,7 @@ static SEL eqSel = @selector(isEqual:);
|
||||||
|
|
||||||
if (anObject == nil)
|
if (anObject == nil)
|
||||||
{
|
{
|
||||||
NSLog(@"attempt to remove nil object");
|
NSWarnMLog(@"attempt to remove nil object", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
index = _count;
|
index = _count;
|
||||||
|
@ -480,7 +481,7 @@ static SEL eqSel = @selector(isEqual:);
|
||||||
|
|
||||||
if (anObject == nil)
|
if (anObject == nil)
|
||||||
{
|
{
|
||||||
NSLog(@"attempt to remove nil object");
|
NSWarnMLog(@"attempt to remove nil object", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
index = _count;
|
index = _count;
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <Foundation/NSUtilities.h>
|
#include <Foundation/NSUtilities.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <Foundation/NSPortCoder.h>
|
#include <Foundation/NSPortCoder.h>
|
||||||
|
#include <Foundation/NSDebug.h>
|
||||||
|
|
||||||
|
|
||||||
#define GSI_MAP_RETAIN_VAL(X)
|
#define GSI_MAP_RETAIN_VAL(X)
|
||||||
|
@ -258,7 +259,7 @@
|
||||||
|
|
||||||
if (anObject == nil)
|
if (anObject == nil)
|
||||||
{
|
{
|
||||||
NSLog(@"attempt to remove nil object");
|
NSWarnMLog(@"attempt to remove nil object", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bucket = GSIMapBucketForKey(&map, (GSIMapKey)anObject);
|
bucket = GSIMapBucketForKey(&map, (GSIMapKey)anObject);
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSPortCoder.h>
|
#include <Foundation/NSPortCoder.h>
|
||||||
|
#include <Foundation/NSDebug.h>
|
||||||
|
|
||||||
#include <base/behavior.h>
|
#include <base/behavior.h>
|
||||||
#include <base/fast.x>
|
#include <base/fast.x>
|
||||||
|
@ -383,7 +384,7 @@ myEqual(id self, id other)
|
||||||
{
|
{
|
||||||
if (aKey == nil)
|
if (aKey == nil)
|
||||||
{
|
{
|
||||||
NSLog(@"attempt to remove nil key");
|
NSWarnMLog(@"attempt to remove nil key", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GSIMapRemoveKey(&map, (GSIMapKey)aKey);
|
GSIMapRemoveKey(&map, (GSIMapKey)aKey);
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <Foundation/NSUtilities.h>
|
#include <Foundation/NSUtilities.h>
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <Foundation/NSPortCoder.h>
|
#include <Foundation/NSPortCoder.h>
|
||||||
|
#include <Foundation/NSDebug.h>
|
||||||
|
|
||||||
#define GSI_MAP_HAS_VALUE 0
|
#define GSI_MAP_HAS_VALUE 0
|
||||||
#define GSI_MAP_KTYPES GSUNION_OBJ
|
#define GSI_MAP_KTYPES GSUNION_OBJ
|
||||||
|
@ -236,7 +237,7 @@
|
||||||
{
|
{
|
||||||
if (anObject == nil)
|
if (anObject == nil)
|
||||||
{
|
{
|
||||||
NSLog(@"attempt to remove nil object");
|
NSWarnMLog(@"attempt to remove nil object", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GSIMapRemoveKey(&map, (GSIMapKey)anObject);
|
GSIMapRemoveKey(&map, (GSIMapKey)anObject);
|
||||||
|
|
Loading…
Reference in a new issue