Changeset 375 for cpp/common/log.h


Ignore:
Timestamp:
04/26/15 00:59:09 (9 years ago)
Author:
Maciej Komosinski
Message:

Renamed logging functions to more intuitive and simple names

File:
1 moved

Legend:

Unmodified
Added
Removed
  • cpp/common/log.h

    r372 r375  
    33// See LICENSE.txt for details.
    44
    5 #ifndef _HMESSAGE_H_
    6 #define _HMESSAGE_H_
     5#ifndef _COMMON_LOG_H_
     6#define _COMMON_LOG_H_
    77
    88#include <stdarg.h>
    99
    10 extern const char* HMSG_LEVEL[];
    11 #define HMSG_FORMAT "%s%s.%s: %s"
    12 #define HMSG_MULTILINE_CONTINUATION "..."
     10extern const char* LOG_LEVEL[];
     11#define LOG_FORMAT "%s%s.%s: %s"
     12#define LOG_MULTILINE_CONTINUATION "..."
    1313
    14 void Hprintf(const char *o,const char *m,int w,const char *bl, ...);
    15 void Hprintf_va(const char *o,const char *m,int w,const char *bl,va_list va); //a different name than Hprintf - otherwise the compiler could confuse the "string" parameter with va_list and could call the wrong function
    16 void printH(const char *bl,...); //a shorthand for printf (a different name again to avoid the risk of confusion with the two functions above. This would be unlikely but possible when the argument types would match)
    17 void Hmessage(const char *o,const char *m,const char *txt,int w);
    1814
    19 void _HmessageSingleLine(const char *o,const char *m,const char *txt,int w); //don't call this directly - it is used internally
     15void logPrintf(const char *obj, const char *method, int level, const char *msgf, ...);
     16void logPrintf_va(const char *obj, const char *method, int level, const char *msgf, va_list va); //a different name than logPrintf - otherwise the compiler could confuse the "string" parameter with va_list and could call the wrong function
     17void log_printf(const char *msgf, ...); //a shorthand for printf (a different name again to avoid the risk of confusion with the two functions above. This would be unlikely but possible when the argument types would match)
     18void logMessage(const char *obj, const char *method, int level, const char *msg);
    2019
    21 #define HMLV_DEBUG -1
    22 #define HMLV_INFO 0
    23 #define HMLV_WARN 1
    24 #define HMLV_ERROR 2
    25 #define HMLV_CRITICAL 3
     20void _logMessageSingleLine(const char *obj, const char *method, int level, const char *msg); //don't call this directly - it is used internally
    2621
    27 /*
    28 w: weight (importance) of a message
    29 -1:debugging information, not needed for final users
    30 0: information
    31 1: warning or corrected error
    32 2: uncorrected error. can cause malfunction
    33 3: serious error, causes side effects. user should save what can be saved and restart the application
    34 */
     22
     23
     24//level (importance) of a message
     25#define LOG_DEBUG -1 //debugging information, not needed for final users
     26#define LOG_INFO 0 //information
     27#define LOG_WARN 1 //warning or corrected error
     28#define LOG_ERROR 2 //uncorrected error, can cause malfunction
     29#define LOG_CRITICAL 3 //serious error, causes side effects. User should save what can be saved and restart the application
    3530
    3631#endif
Note: See TracChangeset for help on using the changeset viewer.