// The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt /* This is an example showing how to control where the dlib::logger sends its messages. This is done by creating a "hook" class that is called whenever any of the loggers want to log a message. The hook class then outputs the messages using any method you like. Prior to reading this example, you should understand the basics of the dlib::logger. So you should have already read the logger_ex.cpp and logger_ex_2.cpp example programs. */ #include using namespace dlib; using namespace std; class my_hook { public: my_hook( ) { fout.open("my_log_file.txt"); } void log ( const string& logger_name, const log_level& ll, const uint64 thread_id, const char* message_to_log ) { // Log all messages from any logger to our log file. fout << ll << " ["<= LINFO) cout << ll << " ["<