API: Logger
Overview
In order to use API: Logger you need to include logger_api.h file into your sources. More…
// macros #define ENTRY(_fs...) #define ERROR(_fs...) #define EXIT(_fs...) #define INFO(_fs...) #define LGR_MESSAGE(_lvl, _lgruser, _fs...) #define LOG_MSG(_lvl, _fs...) #define RING(_fs...) #define TE_DO_IF_LOG_LEVEL(_lvl, ...) #define TE_LOG(_level, _entity, _user, _fs...) #define TE_LOG_ENTRY(_us, _fs...) #define TE_LOG_ERROR(_us, _fs...) #define TE_LOG_EXIT(_us, _fs...) #define TE_LOG_INFO(_us, _fs...) #define TE_LOG_ONCE(_log_fn, _fs...) #define TE_LOG_RING(_us, _fs...) #define TE_LOG_VERB(_us, _fs...) #define TE_LOG_WARN(_us, _fs...) #define VERB(_fs...) #define WARN(_fs...) #define _LOG_ENTRY(_us, _fs, _args...) #define _LOG_EXIT(_us, _fs, _args...)
Detailed Documentation
In order to use API: Logger you need to include logger_api.h file into your sources.
If you want to use short versions of API: Logger functions you need to define TE_LGR_USER macro at the beginning of source file.
For example your code might look like:
#define TE_LGR_USER "My module" #include "te_config.h" ... #include "logger_api.h" ... ERROR("An error condition happens: %s", result_string);
Macros
#define ENTRY(_fs...)
Logging of entry to a function
Parameters:
_fs |
format string and arguments |
#define ERROR(_fs...)
Logging abnormal/unexpected situations with user-defined log user name TE_LGR_USER.
Parameters:
_fs |
format string and arguments |
#define EXIT(_fs...)
Logging of exit from a function
Parameters:
_fs |
format string and arguments |
#define INFO(_fs...)
Logging important event for debugging of the test
Parameters:
_fs |
format string and arguments |
#define LGR_MESSAGE(_lvl, _lgruser, _fs...)
Log message of the specified level from the user.
This macro is intended for internal purposes and should not be used directly outside of this file.
Parameters:
_lvl |
log level of the message |
_lgruser |
log user name |
_fs |
format string and arguments |
#define LOG_MSG(_lvl, _fs...)
Log message from default user with specified level.
Parameters:
_lvl |
log level of the message |
_fs |
format string and arguments |
#define RING(_fs...)
Logging very important events in TE and tests required to understand testing results
Parameters:
_fs |
format string and arguments |
#define TE_DO_IF_LOG_LEVEL(_lvl, ...)
Expand variadic arguments only if _lvl
is currently enabled.
The macro is intended to wrap other logging functions, e.g.:
TE_IF_LOG_LEVEL(TE_LL_VERB, log_pkt_contents(pkt))
Parameters:
_lvl |
Log level |
… |
The code to be executed only if |
#define TE_LOG(_level, _entity, _user, _fs...)
Unconditional logging.
Parameters:
_level |
log level of the message |
_entity |
log entity name |
_user |
log user name |
_fs |
format string and arguments |
#define TE_LOG_ENTRY(_us, _fs...)
Logging of entry to a function
Parameters:
_us |
log user name |
_fs |
format string and arguments |
#define TE_LOG_ERROR(_us, _fs...)
Logging abnormal/unexpected situations
Parameters:
_us |
log user name |
_fs |
format string and arguments |
#define TE_LOG_EXIT(_us, _fs...)
Logging of exit from a function
Parameters:
_us |
log user name |
_fs |
format string and arguments |
#define TE_LOG_INFO(_us, _fs...)
Logging important event for debugging of the test
Parameters:
_us |
log user name |
_fs |
format string and arguments |
#define TE_LOG_ONCE(_log_fn, _fs...)
Log a message once at a given place.
Parameters:
_log_fn |
Name of a logging macro, e.g. |
_fs |
Format string and arguments. |
#define TE_LOG_RING(_us, _fs...)
Logging very important events in TE and tests required to understand testing results
Parameters:
_us |
log user name |
_fs |
format string and arguments |
#define TE_LOG_VERB(_us, _fs...)
Logging additional events for detalization of processing
Parameters:
_us |
log user name |
_fs |
format string and arguments |
#define TE_LOG_WARN(_us, _fs...)
Logging situations of some failed initialization of the optional feature or some unexpected events that does not break operation
Parameters:
_us |
log user name |
_fs |
format string and arguments |
#define VERB(_fs...)
Logging additional events for detalization of processing
Parameters:
_fs |
format string and arguments |
#define WARN(_fs...)
Logging situations some failed initialization of the optional feature
Parameters:
_fs |
format string and arguments |
#define _LOG_ENTRY(_us, _fs, _args...)
Auxiliary macro to insert FUNCTION just after format string before arguments.
#define _LOG_EXIT(_us, _fs, _args...)
Auxiliary macro to insert LINE and FUNCTION just after format string before arguments.