29#ifndef NOMLIB_CORE_SDL2_LOGGER_HPP
30#define NOMLIB_CORE_SDL2_LOGGER_HPP
61 NOM = SDL_LOG_CATEGORY_CUSTOM,
64 NOM_LOG_CATEGORY_APPLICATION,
67 NOM_LOG_CATEGORY_ERROR,
70 NOM_LOG_CATEGORY_ASSERT,
73 NOM_LOG_CATEGORY_SYSTEM,
76 NOM_LOG_CATEGORY_AUDIO,
79 NOM_LOG_CATEGORY_VIDEO,
82 NOM_LOG_CATEGORY_RENDER,
85 NOM_LOG_CATEGORY_ACTION,
88 NOM_LOG_CATEGORY_ACTION_PLAYER,
91 NOM_LOG_CATEGORY_ACTION_QUEUE,
94 NOM_LOG_CATEGORY_EVENT,
97 NOM_LOG_CATEGORY_TEST,
100 NOM_LOG_CATEGORY_GUI,
103 NOM_LOG_CATEGORY_MEMORY,
106 NOM_LOG_CATEGORY_MEMORY_TOTALS,
109 NOM_LOG_CATEGORY_STATES,
111 NOM_LOG_CATEGORY_TRACE,
112 NOM_LOG_CATEGORY_TRACE_AUDIO,
115 NOM_LOG_CATEGORY_TRACE_FONTS,
117 NOM_LOG_CATEGORY_TRACE_VIDEO,
118 NOM_LOG_CATEGORY_TRACE_RENDER,
119 NOM_LOG_CATEGORY_TRACE_GUI,
120 NOM_LOG_CATEGORY_TRACE_EVENT,
123 NOM_LOG_CATEGORY_TRACE_STATES,
125 NOM_LOG_CATEGORY_TRACE_SYSTEM,
128 NOM_LOG_CATEGORY_TRACE_UNIT_TEST,
131 NOM_LOG_CATEGORY_TRACE_ACTION,
145 NOM_LOG_CATEGORY_CUSTOM
158 NOM_LOG_PRIORITY_VERBOSE = SDL_LOG_PRIORITY_VERBOSE,
159 NOM_LOG_PRIORITY_DEBUG = SDL_LOG_PRIORITY_DEBUG,
160 NOM_LOG_PRIORITY_INFO = SDL_LOG_PRIORITY_INFO,
161 NOM_LOG_PRIORITY_WARN = SDL_LOG_PRIORITY_WARN,
162 NOM_LOG_PRIORITY_ERROR = SDL_LOG_PRIORITY_ERROR,
163 NOM_LOG_PRIORITY_CRITICAL = SDL_LOG_PRIORITY_CRITICAL,
164 NOM_NUM_LOG_PRIORITIES = SDL_NUM_LOG_PRIORITIES
173NOM_EXPORT
void log_message(
void* ptr,
int cat, SDL_LogPriority prio,
const char* msg );
183template<
typename Type>
184NOM_EXPORT
void write_debug_output( std::ostream& out,
const Type& f )
233 template <
typename Type,
typename ... Args>
234 void write(
const Type& f,
const Args& ... rest )
240 this->
write( rest... );
249 template <
typename Type>
255 void write(uint8_t f)
257 nom::write_debug_output(this->output_stream(), (
int)f);
282 static LogPriority
priority( SDL_LogPriority prio );
313 self_type& operator =(
const self_type& rhs ) =
delete;
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.
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.