MCPcopy Create free account
hub / github.com/davisking/dlib / setup_loggers

Function setup_loggers

examples/logger_ex_2.cpp:84–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82
83
84void setup_loggers (
85)
86{
87 // Create a logger that has the same name as our root logger logp. This isn't very useful in
88 // this example program but if you had loggers defined in other files then you might not have
89 // easy access to them when starting up your program and setting log levels. This mechanism
90 // allows you to manipulate the properties of any logger so long as you know its name.
91 logger temp_log("example");
92
93 // For this example I don't want to log debug messages so I'm setting the logging level of
94 // All our loggers to LINFO. Note that this statement sets all three of our loggers to this
95 // logging level because they are all children of temp_log.
96 temp_log.set_level(LINFO);
97
98
99 // In addition I only want the example.test_class to print LWARN or higher messages so I'm going
100 // to set that here too. Note that we set this value after calling temp_log.set_level(). If we
101 // did it the other way around the set_level() call on temp_log would set logc_temp.level() and
102 // logc.level() back to LINFO since temp_log is a parent of logc_temp.
103 logger logc_temp("example.test_class");
104 logc_temp.set_level(LWARN);
105
106
107 // Finally, note that you can also configure your loggers from a text config file.
108 // See the documentation for the configure_loggers_from_file() function for details.
109}
110
111int main()
112{

Callers 1

mainFunction · 0.85

Calls 1

set_levelMethod · 0.80

Tested by

no test coverage detected