Singletion pattern for C++ logger -


i need design logger class used other classed log messages. creating poiner of logger in each of classes , calling method of logger thorugh logger pointer log messages. want design in singleton pattern way , has thread safe. can suggest approach.

forget singleton, make in class static. want provide macros access log method, example:

#define logdbg(fmt, ...) log::log(__function__, log::level_debug, fmt, ##__va_args__) 

which, when implemented singleton need be:

#define logdbg(fmt, ...) log::instance().log(__function__, log::level_debug, fmt, ##__va_args__) 

which makes little difference.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

ruby - Nesting modules inside of a Rails eninge gem -

Eclipse formatter for java ending braces -