diff -r d84d25d6cdbb -r 2d492d8c2053 Logging.h --- a/Logging.h Sat Mar 08 21:04:41 2008 -0800 +++ b/Logging.h Fri Apr 18 09:25:10 2008 -0700 @@ -12,12 +12,23 @@ NSString* LOC( NSString *key ); // Localized string lookup -#define Log(FMT,ARGS...) do{if(__builtin_expect(gShouldLog,0)) _Log(FMT,##ARGS);}while(0) +#define Log(FMT,ARGS...) do{if(__builtin_expect(_gShouldLog,0)) _Log(FMT,##ARGS);}while(0) #define Warn Warn void AlwaysLog( NSString *msg, ... ) __attribute__((format(__NSString__, 1, 2))); +#define LogTo(DOMAIN,FMT,ARGS...) do{if(__builtin_expect(_gShouldLog,0)) _LogTo(@""#DOMAIN,FMT,##ARGS);}while(0) -extern int gShouldLog; +BOOL _WillLogTo( NSString *domain ); +BOOL EnableLog( BOOL enable ); +#define EnableLogTo( DOMAIN, VALUE ) _EnableLogTo(@""#DOMAIN, VALUE) +#define WillLogTo( DOMAIN ) _WillLogTo(@""#DOMAIN) + + +// internals; don't use directly +extern int _gShouldLog; void _Log( NSString *msg, ... ) __attribute__((format(__NSString__, 1, 2))); void Warn( NSString *msg, ... ) __attribute__((format(__NSString__, 1, 2))); +void _LogTo( NSString *domain, NSString *msg, ... ) __attribute__((format(__NSString__, 2, 3))); +BOOL _WillLogTo( NSString *domain ); +BOOL _EnableLogTo( NSString *domain, BOOL enable );