/* This example shows how to use the toast::log_handle. This allows for an application to pass in any log to a library. The library doesn't need to know anything about the log in order to use it. This does have some overhead, but probably no more than a virtual function would have. */ #include <toast/log.hpp> using namespace toast::log; namespace { log_handle mylog; } void set_log_handle(log_handle l) { mylog = l; } void log_handle_log_example() { mylog.message("This behaves however log_handle is setup.", DEBUG); mylog.message("Lo and behold the lovely log_handle!", NOTICE); }