29#ifndef NOMLIB_CORE_SDL2_LOGGER_HPP
30#define NOMLIB_CORE_SDL2_LOGGER_HPP
60 NOM = SDL_LOG_CATEGORY_CUSTOM,
63 NOM_LOG_CATEGORY_APPLICATION,
66 NOM_LOG_CATEGORY_ERROR,
69 NOM_LOG_CATEGORY_ASSERT,
72 NOM_LOG_CATEGORY_SYSTEM,
75 NOM_LOG_CATEGORY_AUDIO,
78 NOM_LOG_CATEGORY_VIDEO,
81 NOM_LOG_CATEGORY_RENDER,
84 NOM_LOG_CATEGORY_ACTION,
87 NOM_LOG_CATEGORY_ACTION_PLAYER,
90 NOM_LOG_CATEGORY_ACTION_QUEUE,
93 NOM_LOG_CATEGORY_EVENT,
96 NOM_LOG_CATEGORY_TEST,
102 NOM_LOG_CATEGORY_MEMORY,
105 NOM_LOG_CATEGORY_MEMORY_TOTALS,
108 NOM_LOG_CATEGORY_STATES,
110 NOM_LOG_CATEGORY_TRACE,
111 NOM_LOG_CATEGORY_TRACE_AUDIO,
114 NOM_LOG_CATEGORY_TRACE_FONTS,
116 NOM_LOG_CATEGORY_TRACE_VIDEO,
117 NOM_LOG_CATEGORY_TRACE_RENDER,
118 NOM_LOG_CATEGORY_TRACE_GUI,
119 NOM_LOG_CATEGORY_TRACE_EVENT,
122 NOM_LOG_CATEGORY_TRACE_STATES,
124 NOM_LOG_CATEGORY_TRACE_SYSTEM,
127 NOM_LOG_CATEGORY_TRACE_UNIT_TEST,
130 NOM_LOG_CATEGORY_TRACE_ACTION,
144 NOM_LOG_CATEGORY_CUSTOM
157 NOM_LOG_PRIORITY_VERBOSE = SDL_LOG_PRIORITY_VERBOSE,
158 NOM_LOG_PRIORITY_DEBUG = SDL_LOG_PRIORITY_DEBUG,
159 NOM_LOG_PRIORITY_INFO = SDL_LOG_PRIORITY_INFO,
160 NOM_LOG_PRIORITY_WARN = SDL_LOG_PRIORITY_WARN,
161 NOM_LOG_PRIORITY_ERROR = SDL_LOG_PRIORITY_ERROR,
162 NOM_LOG_PRIORITY_CRITICAL = SDL_LOG_PRIORITY_CRITICAL,
163 NOM_NUM_LOG_PRIORITIES = SDL_NUM_LOG_PRIORITIES
172void log_message(
void* ptr,
int cat, SDL_LogPriority prio,
const char* msg );
182template<
typename Type>
183void write_debug_output( std::ostream& out,
const Type& f )
232 template <
typename Type,
typename ... Args>
233 void write(
const Type& f,
const Args& ... rest )
239 this->
write( rest... );
248 template <
typename Type>
254 void write(uint8_t f)
281 static LogPriority
priority( SDL_LogPriority prio );
static void set_logging_priorities(LogPriority prio)
Set the logging priority for all logging categories.
void write()
Write a log message to the output stream.
int category_
The logging category of the log message.
static void initialize()
Set the default logging category priority levels.
LogPriority priority() const
Get the logging priority level.
static void set_logging_priority(int cat, LogPriority prio)
Set the logging priority for a log category.
std::ostringstream & output_stream()
Get the log message.
static const std::string priority_prefixes_[NOM_NUM_LOG_PRIORITIES]
Human-friendly descriptions of the logging priorities.
static bool initialized_
Ensure one-time initialization of the setting of logging category priorities.
SDL2Logger()
Default constructor; initialize the log category to NOM and the log priority to LogPriority::NOM_LOG_...
std::ostringstream os_
The log message stream.
SDL2Logger(const self_type &rhs)=delete
Copy constructor.
static LogPriority priority(SDL_LogPriority prio)
Convert an underlying implementation's logging priority level.
nom::LogPriority priority_
The logging priority of the log message.
SDL2Logger(int cat, nom::LogPriority prio)
Construct a logging object.
void write(const Type &f, const Args &... rest)
Write one or more log messages to the output stream.
static SDL_LogPriority SDL_priority(LogPriority prio)
Convert the logging priority level to the underlying implementation's type.
self_type & operator=(const self_type &rhs)=delete
Copy assignment constructor.
void write(const Type &f)
Write a log message to the output stream.
static bool initialized(void)
Get initialization status of the default logging category priorities.
~SDL2Logger()
Destructor; the logging category, logging priority level and output stream is sent to the underlying ...
int category() const
Get the logging category.