logog
logger optimized for games
|
Go to the source code of this file.
Namespaces | |
logog | |
[Thread] | |
Macros | |
#define | LOGOG_GROUP NULL |
#define | LOGOG_CATEGORY NULL |
#define | TOKENPASTE2(x, y) x ## y |
#define | TOKENPASTE(x, y) TOKENPASTE2(x, y) |
#define | LOGOG_LEVEL_GROUP_CATEGORY_MESSAGE_NO_VA(level, group, cat, msg) |
#define | LOGOG_LEVEL_GROUP_CATEGORY_MESSAGE(level, group, cat, formatstring, ...) |
#define | LOGOG_LEVEL_MESSAGE(level, formatstring, ...) LOGOG_LEVEL_GROUP_CATEGORY_MESSAGE( level, LOGOG_GROUP, LOGOG_CATEGORY, formatstring, ##__VA_ARGS__ ) |
#define | LOGOG_MESSAGE(formatstring, ...) LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL, formatstring, ##__VA_ARGS__ ) |
#define | LOGOG_DEBUG(formatstring, ...) LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_DEBUG, formatstring, ##__VA_ARGS__ ) |
#define | LOGOG_INFO(formatstring, ...) LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_INFO, formatstring, ##__VA_ARGS__ ) |
#define | LOGOG_WARN3(formatstring, ...) LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_WARN3, formatstring, ##__VA_ARGS__ ) |
#define | LOGOG_WARN2(formatstring, ...) LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_WARN2, formatstring, ##__VA_ARGS__ ) |
#define | LOGOG_WARN1(formatstring, ...) LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_WARN1, formatstring, ##__VA_ARGS__ ) |
#define | LOGOG_WARN(formatstring, ...) LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_WARN, formatstring, ##__VA_ARGS__ ) |
#define | LOGOG_ERROR(formatstring, ...) LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_ERROR, formatstring, ##__VA_ARGS__ ) |
#define | LOGOG_CRITICAL(formatstring, ...) LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_CRITICAL, formatstring, ##__VA_ARGS__ ) |
#define | LOGOG_ALERT(formatstring, ...) LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_ALERT, formatstring, ##__VA_ARGS__ ) |
#define | LOGOG_EMERGENCY(formatstring, ...) LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_EMERGENCY, formatstring, ##__VA_ARGS__ ) |
#define | LOGOG_SET_LEVEL(level) ::logog::SetDefaultLevel( level ); |
#define | DBUG(...) LOGOG_DEBUG( __VA_ARGS__ ) |
[Shorthand] More... | |
#define | INFO(...) LOGOG_INFO( __VA_ARGS__ ) |
#define | WARN3(...) LOGOG_WARN3( __VA_ARGS__ ) |
#define | WARN2(...) LOGOG_WARN2( __VA_ARGS__ ) |
#define | WARN1(...) LOGOG_WARN1( __VA_ARGS__ ) |
#define | WARN(...) LOGOG_WARN( __VA_ARGS__ ) |
#define | ERR(...) LOGOG_ERROR( __VA_ARGS__ ) |
#define | ALERT(...) LOGOG_ALERT( __VA_ARGS__ ) |
#define | CRITICAL(...) LOGOG_CRITICAL( __VA_ARGS__ ) |
#define | EMERGENCY(...) LOGOG_EMERGENCY( __VA_ARGS__ ) |
#define | LOGOG_INITIALIZE(...) logog::Initialize( __VA_ARGS__ ) |
[Shorthand] More... | |
#define | LOGOG_SHUTDOWN() logog::Shutdown() |
Macros for instantiation of a message.
#define ALERT | ( | ... | ) | LOGOG_ALERT( __VA_ARGS__ ) |
#define CRITICAL | ( | ... | ) | LOGOG_CRITICAL( __VA_ARGS__ ) |
#define DBUG | ( | ... | ) | LOGOG_DEBUG( __VA_ARGS__ ) |
[Shorthand]
Define this compilation flag if your compilation environment conflicts with any of the shorthand logging macros in macro.hpp.
#define EMERGENCY | ( | ... | ) | LOGOG_EMERGENCY( __VA_ARGS__ ) |
#define ERR | ( | ... | ) | LOGOG_ERROR( __VA_ARGS__ ) |
#define INFO | ( | ... | ) | LOGOG_INFO( __VA_ARGS__ ) |
#define LOGOG_ALERT | ( | formatstring, | |
... | |||
) | LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_ALERT, formatstring, ##__VA_ARGS__ ) |
Logs a message at the ALERT reporting level.
#define LOGOG_CATEGORY NULL |
This is the current category for created messages. Set this to NULL if you want messages to not be part of any specific group.
#define LOGOG_CRITICAL | ( | formatstring, | |
... | |||
) | LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_CRITICAL, formatstring, ##__VA_ARGS__ ) |
Logs a message at the CRITICAL reporting level.
#define LOGOG_DEBUG | ( | formatstring, | |
... | |||
) | LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_DEBUG, formatstring, ##__VA_ARGS__ ) |
Logs a message at the DEBUG reporting level.
#define LOGOG_EMERGENCY | ( | formatstring, | |
... | |||
) | LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_EMERGENCY, formatstring, ##__VA_ARGS__ ) |
Logs a message at the EMERGENCY reporting level.
#define LOGOG_ERROR | ( | formatstring, | |
... | |||
) | LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_ERROR, formatstring, ##__VA_ARGS__ ) |
Logs a message at the ERROR reporting level.
#define LOGOG_GROUP NULL |
This is the current group for created messages. Set this to NULL if you want messages to not be part of any specific group.
#define LOGOG_INFO | ( | formatstring, | |
... | |||
) | LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_INFO, formatstring, ##__VA_ARGS__ ) |
Logs a message at the INFO reporting level.
#define LOGOG_INITIALIZE | ( | ... | ) | logog::Initialize( __VA_ARGS__ ) |
[Shorthand]
Call this function to initialize logog and prepare for logging.
#define LOGOG_LEVEL_GROUP_CATEGORY_MESSAGE | ( | level, | |
group, | |||
cat, | |||
formatstring, | |||
... | |||
) |
This macro is used when a message is instantiated with varargs provided by the user. It locks a global mutex, creates the message, locks it, formats the message string inside the message, transmits it, and releases all locks. When logog is shut down, it may be started back up again later. Therefore, logog needs a way to flag all static Message pointers that they need to be recreated. We manually simulate a static Message pointer by implementing it via a static bool. The bool is turned on the first time this code is run. NOTE! A subtle race condition exists in the following code, that will ONLY occur if logog is shut down at the same moment that a log message is processed from another thread than the one calling the shutdown. The Message object could theoretically be destroyed from another thread just before it's locked in a thread that calls the Format() and Transmit() calls on it. I'm not sure if this is really a bug – technically, this race condition will occur only if you are calling log messages right on top of the SHUTDOWN call from the main thread.
#define LOGOG_LEVEL_GROUP_CATEGORY_MESSAGE_NO_VA | ( | level, | |
group, | |||
cat, | |||
msg | |||
) |
This macro is used when a message is instantiated without any varargs provided by the user. It locks a global mutex, creates the message, locks it, transmits it, and releases all locks.
#define LOGOG_LEVEL_MESSAGE | ( | level, | |
formatstring, | |||
... | |||
) | LOGOG_LEVEL_GROUP_CATEGORY_MESSAGE( level, LOGOG_GROUP, LOGOG_CATEGORY, formatstring, ##__VA_ARGS__ ) |
Calls LOGOG_LEVEL_GROUP_CATEGORY_MESSAGE with the current LOGOG_GROUP and LOGOG_CATEGORY setting.
#define LOGOG_MESSAGE | ( | formatstring, | |
... | |||
) | LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL, formatstring, ##__VA_ARGS__ ) |
Calls LOGOG_LEVEL_MESSAGE with the current LOGOG_LEVEL setting.
#define LOGOG_SET_LEVEL | ( | level | ) | ::logog::SetDefaultLevel( level ); |
#define LOGOG_SHUTDOWN | ( | ) | logog::Shutdown() |
Call this function to shut down logog and release all memory allocated.
#define LOGOG_WARN | ( | formatstring, | |
... | |||
) | LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_WARN, formatstring, ##__VA_ARGS__ ) |
Logs a message at the WARN reporting level.
#define LOGOG_WARN1 | ( | formatstring, | |
... | |||
) | LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_WARN1, formatstring, ##__VA_ARGS__ ) |
Logs a message at the WARN1 reporting level.
#define LOGOG_WARN2 | ( | formatstring, | |
... | |||
) | LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_WARN2, formatstring, ##__VA_ARGS__ ) |
Logs a message at the WARN2 reporting level.
#define LOGOG_WARN3 | ( | formatstring, | |
... | |||
) | LOGOG_LEVEL_MESSAGE( LOGOG_LEVEL_WARN3, formatstring, ##__VA_ARGS__ ) |
Logs a message at the WARN3 reporting level.
#define TOKENPASTE | ( | x, | |
y | |||
) | TOKENPASTE2(x, y) |
#define TOKENPASTE2 | ( | x, | |
y | |||
) | x ## y |
When you have a macro replacement, the preprocessor will only expand the macros recursively if neither the stringizing operator # nor the token-pasting operator ## are applied to it. So, you have to use some extra layers of indirection, you can use the token-pasting operator with a recursively expanded argument.
#define WARN | ( | ... | ) | LOGOG_WARN( __VA_ARGS__ ) |
#define WARN1 | ( | ... | ) | LOGOG_WARN1( __VA_ARGS__ ) |
#define WARN2 | ( | ... | ) | LOGOG_WARN2( __VA_ARGS__ ) |
#define WARN3 | ( | ... | ) | LOGOG_WARN3( __VA_ARGS__ ) |