terrain

Real-time terrain generation using marching cubes
git clone git://git.christianermann.dev/terrain
Log | Files | Refs | README | LICENSE

logger.h (1085B)


      1 #pragma once
      2 
      3 #define LOG_WARN_ENABLED  1
      4 #define LOG_INFO_ENABLED  1
      5 #define LOG_DEBUG_ENABLED 1
      6 #define LOG_TRACE_ENABLED 1
      7 
      8 typedef enum LogLevel {
      9     LOG_LEVEL_TRACE = 0,
     10     LOG_LEVEL_DEBUG = 1,
     11     LOG_LEVEL_INFO  = 2,
     12     LOG_LEVEL_WARN  = 3,
     13     LOG_LEVEL_ERROR = 4,
     14     LOG_LEVEL_FATAL = 5
     15 } log_level;
     16 
     17 void log_msg(log_level level, const char *message, ...);
     18 
     19 #define LOGF(message, ...) log_msg(LOG_LEVEL_FATAL, message, ##__VA_ARGS__);
     20 #define LOGE(message, ...) log_msg(LOG_LEVEL_ERROR, message, ##__VA_ARGS__);
     21 
     22 #if LOG_WARN_ENABLED
     23 #define LOGW(message, ...) log_msg(LOG_LEVEL_WARN , message, ##__VA_ARGS__);
     24 #else
     25 #define LOGW(message, ...)
     26 #endif
     27 
     28 #if LOG_INFO_ENABLED
     29 #define LOGI(message, ...) log_msg(LOG_LEVEL_INFO , message, ##__VA_ARGS__);
     30 #else
     31 #define LOGI(message, ...)
     32 #endif
     33 
     34 #if LOG_DEBUG_ENABLED
     35 #define LOGD(message, ...) log_msg(LOG_LEVEL_DEBUG, message, ##__VA_ARGS__);
     36 #else
     37 #define LOGD(message, ...)
     38 #endif
     39 
     40 #if LOG_TRACE_ENABLED
     41 #define LOGT(message, ...) log_msg(LOG_LEVEL_TRACE, message, ##__VA_ARGS__);
     42 #else
     43 #define LOGT(message, ...)
     44 #endif
     45