Changeset 5554


Ignore:
Timestamp:
Feb 20, 2017 12:57:15 AM (7 years ago)
Author:
ming
Message:

Re #1994 (misc): Make the log's sender and thread width a compile-time configurable setting.

Thanks to Richard Mudgett for the suggestion.

Location:
pjproject/trunk/pjlib
Files:
2 edited

Legend:

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

    r5552 r5554  
    470470#ifndef PJ_LOG_INDENT_CHAR 
    471471#   define PJ_LOG_INDENT_CHAR       '.' 
     472#endif 
     473 
     474/** 
     475 * Log sender width. 
     476 * 
     477 * Default: 22 (for 64-bit machines), 14 otherwise 
     478 */ 
     479#ifndef PJ_LOG_SENDER_WIDTH 
     480#   if PJ_HAS_STDINT_H 
     481#       include <stdint.h> 
     482#       if (UINTPTR_MAX == 0xffffffffffffffff) 
     483#           define PJ_LOG_SENDER_WIDTH  22 
     484#       else 
     485#           define PJ_LOG_SENDER_WIDTH  14 
     486#       endif 
     487#   else 
     488#       define PJ_LOG_SENDER_WIDTH  14 
     489#   endif 
     490#endif 
     491 
     492/** 
     493 * Log thread name width. 
     494 * 
     495 * Default: 12 
     496 */ 
     497#ifndef PJ_LOG_THREAD_WIDTH 
     498#   define PJ_LOG_THREAD_WIDTH      12 
    472499#endif 
    473500 
  • pjproject/trunk/pjlib/src/pj/log.c

    r4761 r5554  
    381381    } 
    382382    if (log_decor & PJ_LOG_HAS_SENDER) { 
    383         enum { SENDER_WIDTH = 14 }; 
     383        enum { SENDER_WIDTH = PJ_LOG_SENDER_WIDTH }; 
    384384        pj_size_t sender_len = strlen(sender); 
    385385        if (pre!=log_buffer) *pre++ = ' '; 
     
    396396    } 
    397397    if (log_decor & PJ_LOG_HAS_THREAD_ID) { 
    398         enum { THREAD_WIDTH = 12 }; 
     398        enum { THREAD_WIDTH = PJ_LOG_THREAD_WIDTH }; 
    399399        const char *thread_name = pj_thread_get_name(pj_thread_this()); 
    400400        pj_size_t thread_len = strlen(thread_name); 
Note: See TracChangeset for help on using the changeset viewer.