Changeset 22092 for branches


Ignore:
Timestamp:
Mar 31, 2015, 5:56:39 PM (11 years ago)
Author:
rousseau
Message:

Made simple console logging a build option

Location:
branches/swt
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • branches/swt/Config.kmk

    r22086 r22092  
    338338ifneq ($(PATH_SDK_OS2TK4),)
    339339#
    340 # We can't add Toolkit includes in _INCS (it will casuse then to be searched
     340# We can't add Toolkit includes in _INCS (it will cause them to be searched
    341341# before GCC headers and lead to conflicts), so use -idirafter.
    342342#
     
    344344TEMPLATE_OdinCxx_CXXFLAGS  += -idirafter $(PATH_SDK_OS2TK4)/h
    345345endif
     346
     347#
     348# If DBG_CON is defined, jam it in to globally enable simple console logging.
     349# If not, then per source console logging can be enabled by defining DBG_CON
     350# _before_ the inclusion of the <misc.h> header.
     351#
     352ifneq ($(DBG_CON),undefined)
     353TEMPLATE_OdinCxx_CFLAGS    += -DDBG_CON
     354TEMPLATE_OdinCxx_CXXFLAGS  += -DDBG_CON
     355endif
  • branches/swt/LocalConfig.kmk.tpl

    r21916 r22092  
    88# NOTES:
    99#
    10 #   This file is a template! Copy it to a file named LocalConfig.kmk in 
     10#   This file is a template! Copy it to a file named LocalConfig.kmk in
    1111#   the same directory and modify the copy to fit your local environment.
    1212#
     
    3333#
    3434# PATH_TOOL_ALP := alp.exe
     35
     36#
     37# Globally enable simple console logging.
     38# Per source console logging can be enabled by defining DBG_CON _before_
     39# the inclusion of the <misc.h> header.
     40# DBG_CON=
  • branches/swt/include/dbglog.h

    r22041 r22092  
    1414#ifdef __cplusplus
    1515      extern "C" {
     16#endif
     17
     18// To enable global console logging, use 'kmk DBG_CON=' _or_ set 'DBG_CON='
     19// in LocalConfig.kmk _or_ set DBG_CON to some value in the environment.
     20// Per source console logging can be enabled by defining DBG_CON _before_
     21// the inclusion of the <misc.h> header.
     22#ifdef DBG_CON
     23#define PFXFMT  "**__con_debug(%d)** "
     24#define __con_debug(lvl, fmt, ...)\
     25switch (lvl) {\
     26  case 0:\
     27    break;\
     28  case 2:\
     29    printf(PFXFMT, lvl);\
     30    printf(fmt, __VA_ARGS__);\
     31    break;\
     32  case 3:\
     33    printf(PFXFMT"FUNCTION:%s ", lvl, __FUNCTION__);\
     34    printf(fmt, __VA_ARGS__);\
     35    break;\
     36  case 4:\
     37    printf(PFXFMT"FILE:%s FUNCTION:%s ", lvl, __FILE__, __FUNCTION__);\
     38    printf(fmt, __VA_ARGS__);\
     39    break;\
     40  case 5:\
     41    printf(PFXFMT, lvl);\
     42    printf(fmt, __VA_ARGS__);\
     43    break;\
     44  default:\
     45    printf(fmt, __VA_ARGS__);\
     46    break;\
     47}\
     48fflush(stdout)
     49#else
     50#define __con_debug(lvl, fmt, ...)
    1651#endif
    1752
Note: See TracChangeset for help on using the changeset viewer.