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 update_current_stack_frame_line_number(x)
 hmmm: very temporary until the call stack tracking is available again. More...
 
#define FILTER_LOG(the_logger, to_log, filter)
 Logs a string "to_log" on "the_logger" using the "filter". 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 76 of file logging_macros.h.

◆ CLASS_FILTER_LOG

#define CLASS_FILTER_LOG (   the_logger,
  to_log,
  filter 
)
Value:
{ \
update_current_stack_frame_line_number(__LINE__); \
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); \
} \
update_current_stack_frame_line_number(__LINE__); \
}
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

Class specific logging method that uses a filter.

Definition at line 60 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 42 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); \
} \
}

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 35 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 98 of file logging_macros.h.

◆ INSTANCE_FILTER_LOG

#define INSTANCE_FILTER_LOG (   the_logger,
  to_log,
  filter 
)
Value:
{ \
update_current_stack_frame_line_number(__LINE__); \
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); \
update_current_stack_frame_line_number(__LINE__); \
} \
}

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 82 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 55 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 46 of file logging_macros.h.

◆ update_current_stack_frame_line_number

#define update_current_stack_frame_line_number (   x)

hmmm: very temporary until the call stack tracking is available again.

Definition at line 29 of file logging_macros.h.