Log::~Log() { if( gs_Log == this ) LogSetDefault(nullptr); TimerDestroy(timer); MutexDestroy(mutex); }
Log::Log() { Allocator* alloc = AllocatorGetThis(); LogAddHandler(this, LogConsoleHandler); if( !gs_Log ) LogSetDefault(this); }
Log::Log() : timer(nullptr) , mutex(nullptr) { Allocator* alloc = AllocatorGetThis(); timer = TimerCreate(alloc); mutex = MutexCreate(alloc); LogAddHandler(this, LogConsoleHandler); if( !gs_Log ) LogSetDefault(this); }
int main(int argc, char** argv) { int ret = EXIT_SUCCESS; // Setup default error handling strategy. // ... // Setup the default log stream. Log logger; LogSetDefault(&logger); // Setup the command line handling. AnyOption options; // Use this to active debug mode. options.setFlag("debug", 'd'); options.setVerbose(); options.autoUsagePrint(true); // Process the command line arguments. options.processCommandArgs(argc, argv); String file; ret = ValidateOptions(options, file); if( ret != EXIT_SUCCESS ) { options.printUsage(); return ret; } Runtime runtime; runtime.init(); runtime.shutdown(); return ret; }
Log::~Log() { if( gs_Log == this ) LogSetDefault(nullptr); }