Ignore:
Timestamp:
Jul 19, 2008 5:53:47 PM (16 years ago)
Author:
bennylp
Message:

Ticket #571: Coloring for logs in Linux/UNIX, two more spaces in logs and runtime log colors configuration (thanks Ondrej.Sterbak)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/log.h

    r2039 r2159  
    6969enum pj_log_decoration 
    7070{ 
    71     PJ_LOG_HAS_DAY_NAME   =   1, /**< Include day name [default: no].        */ 
    72     PJ_LOG_HAS_YEAR       =   2, /**< Include year digit [default: no]       */ 
    73     PJ_LOG_HAS_MONTH      =   4, /**< Include month [default: no]            */ 
    74     PJ_LOG_HAS_DAY_OF_MON =   8, /**< Include day of month [default: no]     */ 
    75     PJ_LOG_HAS_TIME       =  16, /**< Include time [default: yes].           */ 
    76     PJ_LOG_HAS_MICRO_SEC  =  32, /**< Include microseconds [yes]             */ 
    77     PJ_LOG_HAS_SENDER     =  64, /**< Include sender in the log [yes].       */ 
    78     PJ_LOG_HAS_NEWLINE    = 128, /**< Terminate each call with newline [yes].*/ 
    79     PJ_LOG_HAS_CR         = 256  /**< Include carriage return [no].          */ 
     71    PJ_LOG_HAS_DAY_NAME   =    1, /**< Include day name [default: no]         */ 
     72    PJ_LOG_HAS_YEAR       =    2, /**< Include year digit [no]                */ 
     73    PJ_LOG_HAS_MONTH      =    4, /**< Include month [no]                     */ 
     74    PJ_LOG_HAS_DAY_OF_MON =    8, /**< Include day of month [no]              */ 
     75    PJ_LOG_HAS_TIME       =   16, /**< Include time [yes]                     */ 
     76    PJ_LOG_HAS_MICRO_SEC  =   32, /**< Include microseconds [yes]             */ 
     77    PJ_LOG_HAS_SENDER     =   64, /**< Include sender in the log [yes]        */ 
     78    PJ_LOG_HAS_NEWLINE    =  128, /**< Terminate each call with newline [yes] */ 
     79    PJ_LOG_HAS_CR         =  256, /**< Include carriage return [no]           */ 
     80    PJ_LOG_HAS_SPACE      =  512, /**< Include two spaces before log [yes]    */ 
     81    PJ_LOG_HAS_COLOR      = 1024  /**< Colorize logs [yes on win32]           */ 
    8082}; 
    8183 
     
    200202 
    201203 
     204/** 
     205 * Set color of log messages. 
     206 * 
     207 * @param level     Log level which color will be changed. 
     208 * @param color     Desired color. 
     209 */ 
     210PJ_DECL(void) pj_log_set_color(int level, pj_color_t color); 
     211 
     212/** 
     213 * Get color of log messages. 
     214 * 
     215 * @param level     Log level which color will be returned. 
     216 * @return          Log color. 
     217 */ 
     218PJ_DECL(pj_color_t) pj_log_get_color(int level); 
     219 
     220 
    202221#else   /* #if PJ_LOG_MAX_LEVEL >= 1 */ 
    203222 
     
    237256 
    238257/** 
     258 * Set color of log messages. 
     259 * 
     260 * @param level     Log level which color will be changed. 
     261 * @param color     Desired color. 
     262 */ 
     263#  define pj_log_set_color(level, color) 
     264 
     265/** 
    239266 * Get current maximum log verbositylevel. 
    240267 * 
     
    249276 */ 
    250277#  define pj_log_get_decor()    0 
     278 
     279/** 
     280 * Get color of log messages. 
     281 * 
     282 * @param level     Log level which color will be returned. 
     283 * @return          Log color. 
     284 */ 
     285#  define pj_log_get_color(level) 0 
    251286 
    252287 
Note: See TracChangeset for help on using the changeset viewer.