MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / InitLogging

Function InitLogging

src/OpenColorIO/Logging.cpp:32–62  ·  view source on GitHub ↗

You must manually acquire the logging mutex before calling this. This will set g_logginglevel, g_initialized, g_loggingOverride

Source from the content-addressed store, hash-verified

30// You must manually acquire the logging mutex before calling this.
31// This will set g_logginglevel, g_initialized, g_loggingOverride
32void InitLogging()
33{
34 if(g_initialized) return;
35
36 g_initialized = true;
37
38 std::string levelstr;
39 Platform::Getenv(OCIO_LOGGING_LEVEL_ENVVAR, levelstr);
40 if(!levelstr.empty())
41 {
42 g_loggingOverride = true;
43 g_logginglevel = LoggingLevelFromString(levelstr.c_str());
44
45 if(g_logginglevel == LOGGING_LEVEL_UNKNOWN)
46 {
47 std::cerr << "[OpenColorIO Warning]: Invalid $OCIO_LOGGING_LEVEL specified. ";
48 std::cerr << "Options: none (0), warning (1), info (2), debug (3)" << std::endl;
49 g_logginglevel = LOGGING_LEVEL_DEFAULT;
50 }
51 }
52 else
53 {
54 g_logginglevel = LOGGING_LEVEL_DEFAULT;
55 }
56
57 if (g_logginglevel == LOGGING_LEVEL_DEBUG)
58 {
59 std::cerr << "[OpenColorIO Debug]: Using OpenColorIO version: "
60 << GetVersion() << "\n";
61 }
62}
63
64// That's the default logging function.
65void DefaultLoggingFunction(const char * message)

Callers 6

GetLoggingLevelFunction · 0.85
SetLoggingLevelFunction · 0.85
LogErrorFunction · 0.85
LogWarningFunction · 0.85
LogInfoFunction · 0.85
LogDebugFunction · 0.85

Calls 4

GetenvFunction · 0.85
LoggingLevelFromStringFunction · 0.85
GetVersionFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected