Split ExceptionUtils out of Test.
5 // Created by Jens Alfke on 1/5/08.
6 // Copyright 2008 Jens Alfke. All rights reserved.
9 #import <Cocoa/Cocoa.h>
12 NSString* LOC( NSString *key ); // Localized string lookup
16 #define IN_SEGMENT(SEG)
18 #define IN_SEGMENT(SEG) auto __attribute__ ((section ("__TEXT, "#SEG))) __attribute__ ((noinline)) void _outofband_(void);\
20 void _outofband_(void)
23 #define Log(FMT,ARGS...) do{if(__builtin_expect(_gShouldLog,0)) {\
24 IN_SEGMENT(Logging){_Log(FMT,##ARGS);}\
26 #define LogTo(DOMAIN,FMT,ARGS...) do{if(__builtin_expect(_gShouldLog,0)) {\
27 IN_SEGMENT(Logging) {_LogTo(@""#DOMAIN,FMT,##ARGS);}\
31 void AlwaysLog( NSString *msg, ... ) __attribute__((format(__NSString__, 1, 2)));
32 BOOL _WillLogTo( NSString *domain );
33 BOOL EnableLog( BOOL enable );
34 #define EnableLogTo( DOMAIN, VALUE ) _EnableLogTo(@""#DOMAIN, VALUE)
35 #define WillLogTo( DOMAIN ) _WillLogTo(@""#DOMAIN)
38 // internals; don't use directly
39 extern int _gShouldLog;
40 void _Log( NSString *msg, ... ) __attribute__((format(__NSString__, 1, 2)));
41 void Warn( NSString *msg, ... ) __attribute__((format(__NSString__, 1, 2)));
42 void _LogTo( NSString *domain, NSString *msg, ... ) __attribute__((format(__NSString__, 2, 3)));
43 BOOL _WillLogTo( NSString *domain );
44 BOOL _EnableLogTo( NSString *domain, BOOL enable );