openthread-br
0.3.0-72c0388
|
#include "openthread-br/config.h"
#include <stdarg.h>
#include <stddef.h>
#include "common/types.hpp"
Go to the source code of this file.
Macros | |
#define | otbrLogResult(aError, aFormat, ...) |
#define | otbrLogEmerg(...) otbrLog(OTBR_LOG_EMERG, OTBR_LOG_TAG, __VA_ARGS__) |
#define | otbrLogAlert(...) otbrLog(OTBR_LOG_ALERT, OTBR_LOG_TAG, __VA_ARGS__) |
#define | otbrLogCrit(...) otbrLog(OTBR_LOG_CRIT, OTBR_LOG_TAG, __VA_ARGS__) |
#define | otbrLogErr(...) otbrLog(OTBR_LOG_ERR, OTBR_LOG_TAG, __VA_ARGS__) |
#define | otbrLogWarning(...) otbrLog(OTBR_LOG_WARNING, OTBR_LOG_TAG, __VA_ARGS__) |
#define | otbrLogNotice(...) otbrLog(OTBR_LOG_NOTICE, OTBR_LOG_TAG, __VA_ARGS__) |
#define | otbrLogInfo(...) otbrLog(OTBR_LOG_INFO, OTBR_LOG_TAG, __VA_ARGS__) |
#define | otbrLogDebug(...) otbrLog(OTBR_LOG_DEBUG, OTBR_LOG_TAG, __VA_ARGS__) |
Enumerations | |
enum | otbrLogLevel { OTBR_LOG_EMERG, OTBR_LOG_ALERT, OTBR_LOG_CRIT, OTBR_LOG_ERR, OTBR_LOG_WARNING, OTBR_LOG_NOTICE, OTBR_LOG_INFO, OTBR_LOG_DEBUG } |
Functions | |
otbrLogLevel | otbrLogGetLevel (void) |
void | otbrLogSetLevel (otbrLogLevel aLevel) |
void | otbrLogEnableSyslog (bool aEnabled) |
void | otbrLogInit (const char *aIdent, otbrLogLevel aLevel, bool aPrintStderr) |
void | otbrLog (otbrLogLevel aLevel, const char *aLogTag, const char *aFormat,...) |
void | otbrLogv (otbrLogLevel aLevel, const char *aFormat, va_list aArgList) |
void | otbrLogvNoFilter (otbrLogLevel aLevel, const char *aFormat, va_list aArgList) |
void | otbrDump (otbrLogLevel aLevel, const char *aLogTag, const char *aPrefix, const void *aMemory, size_t aSize) |
const char * | otbrErrorString (otbrError aError) |
void | otbrLogDeinit (void) |
This file define logging interface.
#define otbrLogAlert | ( | ... | ) | otbrLog(OTBR_LOG_ALERT, OTBR_LOG_TAG, __VA_ARGS__) |
Log at level alert.
[in] | ... | Arguments for the format specification. |
#define otbrLogCrit | ( | ... | ) | otbrLog(OTBR_LOG_CRIT, OTBR_LOG_TAG, __VA_ARGS__) |
Log at level critical.
[in] | ... | Arguments for the format specification. |
#define otbrLogDebug | ( | ... | ) | otbrLog(OTBR_LOG_DEBUG, OTBR_LOG_TAG, __VA_ARGS__) |
Log at level debug.
[in] | ... | Arguments for the format specification. |
#define otbrLogEmerg | ( | ... | ) | otbrLog(OTBR_LOG_EMERG, OTBR_LOG_TAG, __VA_ARGS__) |
Log at level emergency.
[in] | ... | Arguments for the format specification. |
#define otbrLogErr | ( | ... | ) | otbrLog(OTBR_LOG_ERR, OTBR_LOG_TAG, __VA_ARGS__) |
Log at level error.
[in] | ... | Arguments for the format specification. |
#define otbrLogInfo | ( | ... | ) | otbrLog(OTBR_LOG_INFO, OTBR_LOG_TAG, __VA_ARGS__) |
Log at level information.
[in] | ... | Arguments for the format specification. |
#define otbrLogNotice | ( | ... | ) | otbrLog(OTBR_LOG_NOTICE, OTBR_LOG_TAG, __VA_ARGS__) |
Log at level notice.
[in] | ... | Arguments for the format specification. |
#define otbrLogResult | ( | aError, | |
aFormat, | |||
... | |||
) |
This macro log an action result according to aError
.
If aError
is OTBR_ERROR_NONE, the log level will be OTBR_LOG_INFO, otherwise OTBR_LOG_WARNING.
[in] | aError | The action result. |
[in] | aFormat | Format string as in printf. |
[in] | ... | Arguments for the format specification. |
#define otbrLogWarning | ( | ... | ) | otbrLog(OTBR_LOG_WARNING, OTBR_LOG_TAG, __VA_ARGS__) |
Log at level warning.
[in] | ... | Arguments for the format specification. |
enum otbrLogLevel |
Logging level.
void otbrDump | ( | otbrLogLevel | aLevel, |
const char * | aLogTag, | ||
const char * | aPrefix, | ||
const void * | aMemory, | ||
size_t | aSize | ||
) |
This function dump memory as hex string at level aLevel
.
[in] | aLevel | Log level of the logger. |
[in] | aLogTag | Log tag. |
[in] | aPrefix | String before dumping memory. |
[in] | aMemory | The pointer to the memory to be dumped. |
[in] | aSize | The size of memory in bytes to be dumped. |
Hex dump data to the log
const char* otbrErrorString | ( | otbrError | aError | ) |
This function converts error code to string.
[in] | aError | The error code. |
void otbrLog | ( | otbrLogLevel | aLevel, |
const char * | aLogTag, | ||
const char * | aFormat, | ||
... | |||
) |
This function log at level aLevel
.
[in] | aLevel | Log level of the logger. |
[in] | aLogTag | Log tag. |
[in] | aFormat | Format string as in printf. |
log to the syslog or log file
void otbrLogDeinit | ( | void | ) |
This function deinitializes the logging service.
void otbrLogEnableSyslog | ( | bool | aEnabled | ) |
Control log to syslog.
[in] | enable | True to log to/via syslog. |
otbrLogLevel otbrLogGetLevel | ( | void | ) |
Get current log level.
Get the current debug log level
void otbrLogInit | ( | const char * | aIdent, |
otbrLogLevel | aLevel, | ||
bool | aPrintStderr | ||
) |
This function initialize the logging service.
[in] | aIdent | Identity of the logger. |
[in] | aLevel | Log level of the logger. |
[in] | aPrintStderr | Whether to log to stderr. |
Initialize logging
void otbrLogSetLevel | ( | otbrLogLevel | aLevel | ) |
Set current log level.
void otbrLogv | ( | otbrLogLevel | aLevel, |
const char * | aFormat, | ||
va_list | aArgList | ||
) |
This function log at level aLevel
.
[in] | aLevel | Log level of the logger. |
[in] | aFormat | Format string as in printf. |
[in] | aArgList | The variable-length arguments list. |
log to the syslog or log file
void otbrLogvNoFilter | ( | otbrLogLevel | aLevel, |
const char * | aFormat, | ||
va_list | aArgList | ||
) |
This function writes logs without filtering with the log level.
[in] | aLevel | Log level of the logger. |
[in] | aFormat | Format string as in printf. |
[in] | aArgList | The variable-length arguments list. |