1 /** 2 * Internal logging facilities 3 */ 4 module birchwood.logging; 5 6 import gogga; 7 import gogga.extras; 8 import dlog.basic : Level, FileHandler; 9 import std.stdio : stdout; 10 11 /** 12 * Globally available logger 13 */ 14 package __gshared GoggaLogger logger; 15 16 /** 17 * Initializes a logger instance 18 * globally 19 */ 20 __gshared static this() 21 { 22 logger = new GoggaLogger(); 23 24 GoggaMode mode; 25 26 // TODO: Add flag support 27 version(DBG_VERBOSE_LOGGING) 28 { 29 mode = GoggaMode.RUSTACEAN; 30 } 31 else 32 { 33 mode = GoggaMode.SIMPLE; 34 } 35 36 logger.mode(mode); 37 38 Level level = Level.DEBUG; 39 40 // TODO: Add flag support 41 // version(DBG_DEBUG_LOGGING) 42 // { 43 // level = Level.DEBUG; 44 // } 45 // else 46 // { 47 // level = Level.INFO; 48 // } 49 50 51 logger.setLevel(level); 52 logger.addHandler(new FileHandler(stdout)); 53 } 54 55 // Bring in helper methods 56 mixin LoggingFuncs!(logger);