Reference implementation of Logging stack as a header-only library. More...
Go to the source code of this file.
Macros | |
#define | LIBRARY_LOG_NAME "<LIBRARY_NAME>" |
The name of the library or demo to add as metadata in log messages from the library or demo. More... | |
#define | FILENAME ( strrchr( __FILE__, '/' ) ? strrchr( __FILE__, '/' ) + 1 : __FILE__ ) |
Macro to extract only the file name from file path to use for metadata in log messages. | |
#define | LOG_METADATA_FORMAT "[%s] [%s:%d] " |
Format of metadata prefix in log messages as [<Logging-Level>] [<Library-Name>] [<File-Name>:<Line-Number>] | |
#define | LOG_METADATA_ARGS LIBRARY_LOG_NAME, FILENAME, __LINE__ |
Arguments into the metadata logging prefix format. | |
#define | SdkLog(string) printf string |
Common macro that maps all the logging interfaces, (LogDebug, LogInfo, LogWarn, LogError) to the platform-specific logging function. More... | |
#define | LogDebug(message) SdkLog( ( "[DEBUG] "LOG_METADATA_FORMAT, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) ) |
Definition of logging interface macro that logs messages at the "Debug" level, when debug level logging is enabled. More... | |
#define | LogInfo(message) SdkLog( ( "[INFO] "LOG_METADATA_FORMAT, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) ) |
Definition of logging interface macro that logs messages at the "Info" level, when info level logging is enabled. More... | |
#define | LogWarn(message) SdkLog( ( "[WARN] "LOG_METADATA_FORMAT, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) ) |
Definition of logging interface macro that logs messages at the "Warning" level, when warning level logging is enabled. More... | |
#define | LogError(message) SdkLog( ( "[ERROR] "LOG_METADATA_FORMAT, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) ) |
Definition of logging interface macro that logs messages at the "Error" level, when error level logging is enabled. More... | |
Reference implementation of Logging stack as a header-only library.
#define LIBRARY_LOG_NAME "<LIBRARY_NAME>" |
The name of the library or demo to add as metadata in log messages from the library or demo.
This metadata aids in identifying the module source of log messages. The metadata is logged in the format [ <LIBRARY-NAME> ]
as a prefix to the log messages. Refer to LOG_METADATA_FORMAT for the complete format of the metadata prefix in log messages.
#define SdkLog | ( | string | ) | printf string |
#define LogDebug | ( | message | ) | SdkLog( ( "[DEBUG] "LOG_METADATA_FORMAT, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) ) |
Definition of logging interface macro that logs messages at the "Debug" level, when debug level logging is enabled.
Disable definition of logging interface macros when generating doxygen output, to avoid conflict with documentation of macros at the end of the file.
This macro is only enabled for LOG_DEBUG level configuration in this logging stack implementation.
#define LogInfo | ( | message | ) | SdkLog( ( "[INFO] "LOG_METADATA_FORMAT, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) ) |
#define LogWarn | ( | message | ) | SdkLog( ( "[WARN] "LOG_METADATA_FORMAT, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) ) |
#define LogError | ( | message | ) | SdkLog( ( "[ERROR] "LOG_METADATA_FORMAT, LOG_METADATA_ARGS ) ); SdkLog( message ); SdkLog( ( "\r\n" ) ) |
Definition of logging interface macro that logs messages at the "Error" level, when error level logging is enabled.
This macro is only enabled for all logging level configurations unless except the LOG_NONE configuration.