Simple utilities sink - stuff that doesn't fit anywhere else / objects in plain C Snapshot
Defines | Enumerations | Functions | Variables
logg.h File Reference
#include <stdlib.h>

Go to the source code of this file.

Defines

#define MLOG_ERROR(...)   do { if (m_current_log_level >= MLOG_LEVEL_ERROR) { MLOG_printf( MLOG_LEVEL_ERROR, __FILE__, __LINE__, __VA_ARGS__ ); } } while(0);
#define MLOG_WARN(...)   do { if (m_current_log_level >= MLOG_LEVEL_WARN) { MLOG_printf( MLOG_LEVEL_WARN, __FILE__, __LINE__, __VA_ARGS__ ); } } while(0);
#define MLOG_INFO(...)   do { if (m_current_log_level >= MLOG_LEVEL_INFO) { MLOG_printf( MLOG_LEVEL_INFO, __FILE__, __LINE__, __VA_ARGS__ ); } } while(0);
#define MLOG_DEBUG(...)   do { if (m_current_log_level >= MLOG_LEVEL_DEBUG) { MLOG_printf( MLOG_LEVEL_DEBUG, __FILE__, __LINE__, __VA_ARGS__ ); } } while(0);
#define MLOG_TRACE(...)   do { if (m_current_log_level >= MLOG_LEVEL_TRACE) { MLOG_printf( MLOG_LEVEL_TRACE, __FILE__, __LINE__, __VA_ARGS__ ); } } while(0);

Enumerations

enum  MLOG_LEVEL {
  MLOG_LEVEL_TURN_OFF_LOGGING, MLOG_LEVEL_ERROR, MLOG_LEVEL_WARN, MLOG_LEVEL_INFO,
  MLOG_LEVEL_DEBUG, MLOG_LEVEL_TRACE
}
 defined logging levels More...
enum  MLOG_ACTION { MLOG_ACTION_TO_FILE = 0x1, MLOG_ACTION_SYSLOG_TRACE = 0x2, MLOG_ACTION_CONSOLE = 0x4 }
 actions for logging stuff More...
enum  MLOG_PREFIX { MLOG_PREFIX_LOG_LEVEL = 0x1, MLOG_PREFIX_SOURCE_FILE = 0x2, MLOG_PREFIX_TIME = 0x4 }
 features to include in logging prefix More...
enum  MLOG_ALLOC { MLOG_ALLOC_STACK, MLOG_ALLOC_HEAP, MLOG_ALLOC_TLS_HEAP }
 how to allocation the scrach pad buffer for logging More...

Functions

int MLOG_init (MLOG_LEVEL current, MLOG_ACTION action, void *arg)
 explicitly initialises logging.
void MLOG_set_prefix_features (int prefix)
 sets level of detail added to prefix of log entry (A bitmask of MLOG_PREFIX values)
int MLOG_alloc_option (MLOG_ALLOC option, size_t size)
 determines memory allocation stragegy used here
void MLOG_dump_stack_level (MLOG_LEVEL stack_dump_level)
 set log level for which the current stack is dumped. By default this would happen for LOG_LEVEL_ERROR
int MLOG_printf (MLOG_LEVEL current, const char *file, int line, const char *format,...)
 create a log entry, do not use this function directly, use MLOG_<LOG_LEVEL_NAME> macros instead

Variables

MLOG_LEVEL m_current_log_level