11 debug, note, warn, error, fatal
15 * conv::to_string will be used to convert whatever argument is send
16 * to the logger to a string. If another type shall be supported,
17 * just add the appropriate overload and you can start using it right
18 * away. The default conversion will use a stringstream.
22 inline std::string to_string( const T& arg ) {
23 std::ostringstream stream;
27 inline std::string to_string( std::string&& arg ) {
30 inline std::string to_string( const std::string& arg ) {
33 inline std::string to_string( const char* arg ) {
39 void log( level, const std::vector<std::string>& args );
40 void logf( level, const std::string&, std::vector<std::string> args );
43 void set_stream( std::ostream& );
45 template <typename... Args>
46 void log( level l, Args&& ... data ) {
47 impl::log( l, {conv::to_string( std::forward<Args>( data ) )...} );
50 template <typename... Args>
51 void logf( level l, const std::string& format, Args&& ... data ) {
52 impl::logf( l, format, {conv::to_string( std::forward<Args>( data ) )...} );
55 template <typename... Args>
56 void debug( Args&& ... args ) {
57 log( level::debug, std::forward<Args>( args )... );
59 template <typename... Args>
60 void note( Args&& ... args ) {
61 log( level::note, std::forward<Args>( args )... );
63 template <typename... Args>
64 void warn( Args&& ... args ) {
65 log( level::warn, std::forward<Args>( args )... );
67 template <typename... Args>
68 void error( Args&& ... args ) {
69 log( level::error, std::forward<Args>( args )... );
71 template <typename... Args>
72 void fatal( Args&& ... args ) {
73 log( level::fatal, std::forward<Args>( args )... );
76 template <typename... Args>
77 void debugf( const std::string& fmt, Args&& ... args ) {
78 logf( level::debug, fmt, std::forward<Args>( args )... );
80 template <typename... Args>
81 void notef( const std::string& fmt, Args&& ... args ) {
82 logf( level::note, fmt, std::forward<Args>( args )... );
84 template <typename... Args>
85 void warnf( const std::string& fmt, Args&& ... args ) {
86 logf( level::warn, fmt, std::forward<Args>( args )... );
88 template <typename... Args>
89 void errorf( const std::string& fmt, Args&& ... args ) {
90 logf( level::error, fmt, std::forward<Args>( args )... );
92 template <typename... Args>
93 void fatalf( const std::string& fmt, Args&& ... args ) {
94 logf( level::fatal, fmt, std::forward<Args>( args )... );