Ejemplo n.º 1
0
namespace util {

LogLevel gLogLevel;

int LoggingInit() {
    const char* VALID_THRESH_VALUES = "FATAL ERROR WARN INFO DEBUG TRACE";

    char* lvlc = getenv("LOG_THRESH");
    string lvlstr;
    if (lvlc == NULL) {
        printf("You can set logging level with LOG_THRESH. Valid values: %s. Defaulting to INFO\n", VALID_THRESH_VALUES);
        lvlstr = "INFO";
    }
    else lvlstr = string(lvlc);
    if (lvlstr == "FATAL") gLogLevel = LevelFatal;
    else if (lvlstr == "ERROR") gLogLevel =  LevelError;
    else if (lvlstr == "WARN") gLogLevel = LevelWarn;
    else if (lvlstr == "INFO") gLogLevel = LevelInfo;
    else if (lvlstr == "DEBUG") gLogLevel = LevelDebug;
    else if (lvlstr == "TRACE") gLogLevel = LevelTrace;
    else {
        printf("Invalid value for environment variable LOG_THRESH: %s\n", lvlstr.c_str());
        printf("Valid values: %s\n", VALID_THRESH_VALUES);
        abort();
    }
    return 1;
}
int this_is_a_hack_but_rhs_executes_on_library_load = LoggingInit();

}
Ejemplo n.º 2
0
/// Start up the logging subsystem.
static void _InitialiseLogging () {
	CSettings oSettings;
	LoggingInit (&oSettings);
}
Ejemplo n.º 3
0
static void DefaultInitialisation () {
	CLogSettings settings (NULL);
	LoggingInit (&settings);
}
Ejemplo n.º 4
0
static void InitialisationFromPath () {
	CLogSettings settings (TEXT ("/test/with/a/path/name"));
	LoggingInit (&settings);
}