Commit 0544b9aa authored by Davis King's avatar Davis King

Added set_all_logging_headers()

parent 2a224bf0
......@@ -47,6 +47,21 @@ namespace dlib
gd.set_level("",new_level);
}
void set_all_logging_headers (
const print_header_type& new_header
)
{
logger::global_data& gd = logger::get_global_data();
auto_mutex M(gd.m);
gd.loggers.reset();
while (gd.loggers.move_next())
{
gd.loggers.element()->print_header = new_header;
}
gd.set_logger_header("",new_header);
}
// ----------------------------------------------------------------------------------------
namespace logger_helper_stuff
......@@ -300,7 +315,7 @@ namespace dlib
// ----------------------------------------------------------------------------------------
logger::print_header_type logger::global_data::
print_header_type logger::global_data::
logger_header (
const std::string& name
)
......
......@@ -70,6 +70,17 @@ namespace dlib
const log_level& new_level
);
typedef void (*print_header_type)(
std::ostream& out,
const std::string& logger_name,
const log_level& l,
const uint64 thread_id
);
void set_all_logging_headers (
const print_header_type& new_header
);
// ----------------------------------------------------------------------------------------
void print_default_logger_header (
......@@ -352,13 +363,6 @@ namespace dlib
gd.set_output_hook(logger_name, hook);
}
typedef void (*print_header_type)(
std::ostream& out,
const std::string& logger_name,
const log_level& l,
const uint64 thread_id
);
print_header_type logger_header (
) const { return print_header; }
......@@ -602,6 +606,10 @@ namespace dlib
const log_level& new_level
);
friend void set_all_logging_headers (
const print_header_type& new_header
);
friend void set_all_logging_output_streams (
std::ostream& out
);
......
......@@ -79,6 +79,26 @@ namespace dlib
- std::bad_alloc
!*/
// ----------------------------------------------------------------------------------------
typedef void (*print_header_type)(
std::ostream& out,
const std::string& logger_name,
const log_level& l,
const uint64 thread_id
);
void set_all_logging_headers (
const print_header_type& new_header
);
/*!
ensures
- for all loggers L (even loggers not yet constructed):
- #L.logger_header() == new_header
throws
- std::bad_alloc
!*/
// ----------------------------------------------------------------------------------------
template <
......@@ -361,13 +381,6 @@ namespace dlib
- std::bad_alloc
!*/
typedef void (*print_header_type)(
std::ostream& out,
const std::string& logger_name,
const log_level& l,
const uint64 thread_id
);
print_header_type logger_header (
) const;
/*!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment