|
@@ -29,25 +29,25 @@
|
|
|
#define log_message( logger, level, ... ) logger.log( level, { __FILE__, __LINE__, STRING( FUNCTION ) }, __VA_ARGS__ )
|
|
#define log_message( logger, level, ... ) logger.log( level, { __FILE__, __LINE__, STRING( FUNCTION ) }, __VA_ARGS__ )
|
|
|
|
|
|
|
|
namespace logging {
|
|
namespace logging {
|
|
|
- class ilogger_impl;
|
|
|
|
|
- typedef ilogger_impl& (*_binding)(void);
|
|
|
|
|
|
|
+ class logger_impl;
|
|
|
|
|
+ typedef logger_impl& (*_binding)(void);
|
|
|
bool bind_logger_impl(_binding impl);
|
|
bool bind_logger_impl(_binding impl);
|
|
|
|
|
|
|
|
- const char* level_header(ilog_level);
|
|
|
|
|
|
|
+ const char* level_header(log_level);
|
|
|
|
|
|
|
|
- class ilogger {
|
|
|
|
|
|
|
+ class logger {
|
|
|
public:
|
|
public:
|
|
|
- static ilogger& instance();
|
|
|
|
|
- static ilogger& instance(std::string const & key);
|
|
|
|
|
|
|
+ static logger& instance();
|
|
|
|
|
+ static logger& instance(std::string const & key);
|
|
|
public:
|
|
public:
|
|
|
template <typename... Args>
|
|
template <typename... Args>
|
|
|
- inline void log(ilog_level ll,
|
|
|
|
|
|
|
+ inline void log(log_level ll,
|
|
|
std::string const & interp, Args && ...args) {
|
|
std::string const & interp, Args && ...args) {
|
|
|
log( ll, location_info{}, interp, std::forward<Args>(args)... );
|
|
log( ll, location_info{}, interp, std::forward<Args>(args)... );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
template <typename... Args>
|
|
template <typename... Args>
|
|
|
- inline void log(ilog_level ll, location_info info,
|
|
|
|
|
|
|
+ inline void log(log_level ll, location_info info,
|
|
|
std::string const & interp, Args && ...args) {
|
|
std::string const & interp, Args && ...args) {
|
|
|
if ( should_log( ll ) ) {
|
|
if ( should_log( ll ) ) {
|
|
|
log( ll, info, format_msg( interp, std::forward<Args>(args)... ) );
|
|
log( ll, info, format_msg( interp, std::forward<Args>(args)... ) );
|
|
@@ -56,27 +56,27 @@ namespace logging {
|
|
|
|
|
|
|
|
void flush();
|
|
void flush();
|
|
|
|
|
|
|
|
- ~ilogger();
|
|
|
|
|
|
|
+ ~logger();
|
|
|
private:
|
|
private:
|
|
|
- bool should_log( ilog_level ) const;
|
|
|
|
|
- void log( ilog_level ll, location_info info, std::string const& );
|
|
|
|
|
|
|
+ bool should_log( log_level ) const;
|
|
|
|
|
+ void log( log_level ll, location_info info, std::string const& );
|
|
|
|
|
|
|
|
- explicit ilogger(std::string const & name = "");
|
|
|
|
|
- ilogger(ilogger const&);
|
|
|
|
|
- ilogger& operator=(ilogger const&);
|
|
|
|
|
|
|
+ explicit logger(std::string const & name = "");
|
|
|
|
|
+ logger(logger const&);
|
|
|
|
|
+ logger& operator=(logger const&);
|
|
|
|
|
|
|
|
- ilog_level min_level_;
|
|
|
|
|
|
|
+ log_level min_level_;
|
|
|
std::string const logger_name_;
|
|
std::string const logger_name_;
|
|
|
- ilogger_impl& impl_;
|
|
|
|
|
|
|
+ logger_impl& impl_;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- class ilogger_impl {
|
|
|
|
|
|
|
+ class logger_impl {
|
|
|
public:
|
|
public:
|
|
|
- bool should_log( ilog_level ll ) const;
|
|
|
|
|
|
|
+ bool should_log( log_level ll ) const;
|
|
|
virtual void write( logpacket const & pkt ) = 0;
|
|
virtual void write( logpacket const & pkt ) = 0;
|
|
|
virtual void flush() = 0;
|
|
virtual void flush() = 0;
|
|
|
- virtual ~ilogger_impl() = default;
|
|
|
|
|
|
|
+ virtual ~logger_impl() = default;
|
|
|
private:
|
|
private:
|
|
|
- ilog_level min_log_level;
|
|
|
|
|
|
|
+ log_level min_log_level;
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|