#ifndef _LOG_INTERNAL_ #define _LOG_INTERNAL_ // Internal formatting functions #include #include #include namespace log { namespace internal { extern Level level; extern int group; const std::unordered_map LEVEL_LABELS { { LDEBUG, "LDB" }, { DEBUG, "DEB" }, { INFO, "INF" }, { WARNING, "WAR" }, { ERROR, "ERR" }, { CRITICAL, "CRI" } }; void printFormatted(const char * format); template void printFormatted(const char * format, const T & first, const Ts & ... rest) { // Iterate characters in (rest of) format string for (; *format != '\0'; ++format) { // Check for placeholder character if (*format == '%') { // Output first parameter std::cerr << first; // Tail recurseion with rest of string and parameters printFormatted(format + 1, rest...); return; } // If not found, output unformatted character std::cerr << *format; } } } } #endif