Logging.h
changeset 6 2d492d8c2053
parent 0 d84d25d6cdbb
child 8 5588347dfcbd
     1.1 --- a/Logging.h	Sat Mar 08 21:04:41 2008 -0800
     1.2 +++ b/Logging.h	Fri Apr 18 09:25:10 2008 -0700
     1.3 @@ -12,12 +12,23 @@
     1.4  NSString* LOC( NSString *key );     // Localized string lookup
     1.5  
     1.6  
     1.7 -#define Log(FMT,ARGS...) do{if(__builtin_expect(gShouldLog,0)) _Log(FMT,##ARGS);}while(0)
     1.8 +#define Log(FMT,ARGS...) do{if(__builtin_expect(_gShouldLog,0)) _Log(FMT,##ARGS);}while(0)
     1.9  #define Warn Warn
    1.10  
    1.11  void AlwaysLog( NSString *msg, ... ) __attribute__((format(__NSString__, 1, 2)));
    1.12  
    1.13 +#define LogTo(DOMAIN,FMT,ARGS...) do{if(__builtin_expect(_gShouldLog,0)) _LogTo(@""#DOMAIN,FMT,##ARGS);}while(0)
    1.14  
    1.15 -extern int gShouldLog;
    1.16 +BOOL _WillLogTo( NSString *domain );
    1.17 +BOOL EnableLog( BOOL enable );
    1.18 +#define EnableLogTo( DOMAIN, VALUE )  _EnableLogTo(@""#DOMAIN, VALUE)
    1.19 +#define WillLogTo( DOMAIN )  _WillLogTo(@""#DOMAIN)
    1.20 +
    1.21 +
    1.22 +// internals; don't use directly
    1.23 +extern int _gShouldLog;
    1.24  void _Log( NSString *msg, ... ) __attribute__((format(__NSString__, 1, 2)));
    1.25  void Warn( NSString *msg, ... ) __attribute__((format(__NSString__, 1, 2)));
    1.26 +void _LogTo( NSString *domain, NSString *msg, ... ) __attribute__((format(__NSString__, 2, 3)));
    1.27 +BOOL _WillLogTo( NSString *domain );
    1.28 +BOOL _EnableLogTo( NSString *domain, BOOL enable );