feisty meow concerns codebase  2.140
logging_macros.h File Reference
Include dependency graph for logging_macros.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define FILTER_LOG(the_logger, to_log, filter)
 hmmm: very temporary until the call stack tracking is available again. /define update_current_stack_frame_line_number(x) More...
 
#define EMERGENCY_LOG(the_logger, to_log)    FILTER_LOG(the_logger, to_log, basis::ALWAYS_PRINT)
 Logs a string at the emergency level, meaning that it always gets logged. More...
 
#define STAMPED_FILTER_LOG(the_logger, to_log, filter)
 Corresponding functions for including the time and date in the log entry. More...
 
#define STAMPED_EMERGENCY_LOG(the_logger, to_log)    STAMPED_FILTER_LOG(the_logger, to_log, basis::ALWAYS_PRINT)
 Time-stamped logging that will always be printed. More...
 
#define CLASS_FILTER_LOG(the_logger, to_log, filter)
 Class specific logging method that uses a filter. More...
 
#define CLASS_EMERGENCY_LOG(the_logger, to_log)    CLASS_FILTER_LOG(the_logger, to_log, basis::ALWAYS_PRINT)
 Class specific logging method that always prints. More...
 
#define INSTANCE_FILTER_LOG(the_logger, to_log, filter)
 Logs information that includes specific class instance information. More...
 
#define INSTANCE_EMERGENCY_LOG(the_logger, to_log)    INSTANCE_FILTER_LOG(the_logger, to_log, basis::ALWAYS_PRINT)
 Logs with class instance info, but this always prints. More...
 

Detailed Description

these macros can assist in logging. they rely on the base_logger class and the program-wide logger class for logging services. note that it is often convenient to customize one or more of these to yield a simpler macro name per project, such as PRINT or LOG.

Definition in file logging_macros.h.

Macro Definition Documentation

◆ CLASS_EMERGENCY_LOG

#define CLASS_EMERGENCY_LOG (   the_logger,
  to_log 
)     CLASS_FILTER_LOG(the_logger, to_log, basis::ALWAYS_PRINT)

Class specific logging method that always prints.

Definition at line 77 of file logging_macros.h.

◆ CLASS_FILTER_LOG

#define CLASS_FILTER_LOG (   the_logger,
  to_log,
  filter 
)
Value:
{ \
if (the_logger.member(filter)) { \
astring temp_log = to_log; \
if (temp_log.length()) { \
temp_log.insert(0, timely::time_stamp::notarize(true)); \
BASE_FUNCTION(func); \
temp_log += " ["; \
temp_log += function_name; \
temp_log += "]"; \
} \
the_logger.log(temp_log, filter); \
} \
}
static basis::astring notarize(bool add_space=true)
a useful method for getting a textual version of the time "right now".
Definition: time_stamp.cpp:45
void update_current_stack_frame_line_number(int line)
sets the line number for the current frame in the global stack trace.

Class specific logging method that uses a filter.

Definition at line 61 of file logging_macros.h.

◆ EMERGENCY_LOG

#define EMERGENCY_LOG (   the_logger,
  to_log 
)     FILTER_LOG(the_logger, to_log, basis::ALWAYS_PRINT)

Logs a string at the emergency level, meaning that it always gets logged.

Definition at line 43 of file logging_macros.h.

◆ FILTER_LOG

#define FILTER_LOG (   the_logger,
  to_log,
  filter 
)
Value:
{ \
if (the_logger.member(filter)) { \
the_logger.log(to_log, filter); \
} \
}

hmmm: very temporary until the call stack tracking is available again. /define update_current_stack_frame_line_number(x)

Logs a string "to_log" on "the_logger" using the "filter".

The filter is checked before the string is allowed to come into existence, which saves allocations when the item would never be printed out anyway.

Definition at line 36 of file logging_macros.h.

◆ INSTANCE_EMERGENCY_LOG

#define INSTANCE_EMERGENCY_LOG (   the_logger,
  to_log 
)     INSTANCE_FILTER_LOG(the_logger, to_log, basis::ALWAYS_PRINT)

Logs with class instance info, but this always prints.

Definition at line 99 of file logging_macros.h.

◆ INSTANCE_FILTER_LOG

#define INSTANCE_FILTER_LOG (   the_logger,
  to_log,
  filter 
)
Value:
{ \
if (the_logger.member(filter)) { \
astring temp_log = to_log; \
if (temp_log.length()) { \
temp_log.insert(0, timely::time_stamp::notarize(true)); \
BASE_INSTANCE_FUNCTION(func); \
temp_log += " ["; \
temp_log += function_name; \
temp_log += "]"; \
} \
the_logger.log(temp_log, filter); \
} \
}

Logs information that includes specific class instance information.

This use the instance name of the object, which can include more information than the simple class name.

Definition at line 83 of file logging_macros.h.

◆ STAMPED_EMERGENCY_LOG

#define STAMPED_EMERGENCY_LOG (   the_logger,
  to_log 
)     STAMPED_FILTER_LOG(the_logger, to_log, basis::ALWAYS_PRINT)

Time-stamped logging that will always be printed.

Definition at line 56 of file logging_macros.h.

◆ STAMPED_FILTER_LOG

#define STAMPED_FILTER_LOG (   the_logger,
  to_log,
  filter 
)
Value:
{ \
if (the_logger.member(filter)) { \
astring temp_log = to_log; \
if (temp_log.length()) \
temp_log.insert(0, timely::time_stamp::notarize(true)); \
the_logger.log(temp_log, filter); \
} \
}

Corresponding functions for including the time and date in the log entry.

Definition at line 47 of file logging_macros.h.