S2OPC OPCUA Toolkit
|
A log manager providing circular logging, multiple logging categories and levels with thread-safe accesses. More...
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | SOPC_LogSystem_File_Configuration |
structure containing the file system log configuration More... | |
struct | SOPC_LogSystem_User_Configuration |
structure containing the user system log configuration More... | |
union | SOPC_Log_SystemConfiguration |
Provides possible logging configurations. More... | |
struct | SOPC_Log_Configuration |
Defines logging configuration. More... | |
Typedefs | |
typedef struct SOPC_Log_Instance | SOPC_Log_Instance |
typedef void | SOPC_Log_UserDoLog(const char *category, const char *const line) |
Log event callback. More... | |
typedef struct SOPC_LogSystem_File_Configuration | SOPC_LogSystem_File_Configuration |
structure containing the file system log configuration More... | |
typedef struct SOPC_LogSystem_User_Configuration | SOPC_LogSystem_User_Configuration |
structure containing the user system log configuration More... | |
typedef enum SOPC_Log_System | SOPC_Log_System |
log system discriminant More... | |
typedef union SOPC_Log_SystemConfiguration | SOPC_Log_SystemConfiguration |
Provides possible logging configurations. More... | |
typedef struct SOPC_Log_Configuration | SOPC_Log_Configuration |
Defines logging configuration. More... | |
Enumerations | |
enum | SOPC_Log_Level { SOPC_LOG_LEVEL_ERROR = 0, SOPC_LOG_LEVEL_WARNING = 1, SOPC_LOG_LEVEL_INFO = 2, SOPC_LOG_LEVEL_DEBUG = 3, SOPC_LOG_LEVEL_ERROR = 0, SOPC_LOG_LEVEL_WARNING = 1, SOPC_LOG_LEVEL_INFO = 2, SOPC_LOG_LEVEL_DEBUG = 3 } |
enum | SOPC_Log_System { SOPC_LOG_SYSTEM_FILE, SOPC_LOG_SYSTEM_USER, SOPC_LOG_SYSTEM_NO_LOG } |
log system discriminant More... | |
Functions | |
void | SOPC_Log_Initialize (void) |
Initializes the logger manager: generate unique file name prefix for execution. This prefix is only relevant when the logging feature is set to default file logging. Only the first call is taken into account. Further call will be ignored until next call to :: SOPC_Log_Clear. More... | |
SOPC_Log_Instance * | SOPC_Log_CreateFileInstance (const char *logDirPath, const char *logFileName, const char *category, uint32_t maxBytes, uint16_t maxFiles) |
Creates a new log file and log instance and prints the starting timestamp. More... | |
SOPC_Log_Instance * | SOPC_Log_CreateUserInstance (const char *category, SOPC_Log_UserDoLog *logCallback) |
SOPC_Log_Instance * | SOPC_Log_CreateInstanceAssociation (SOPC_Log_Instance *pLogInst, const char *category) |
bool | SOPC_Log_SetLogLevel (SOPC_Log_Instance *pLogInst, SOPC_Log_Level level) |
SOPC_Log_Level | SOPC_Log_GetLogLevel (SOPC_Log_Instance *pLogInst) |
bool | SOPC_Log_SetConsoleOutput (SOPC_Log_Instance *pLogInst, bool activate) |
char * | SOPC_Log_GetFilePathPrefix (SOPC_Log_Instance *pLogInst) |
void | SOPC_Log_Trace (SOPC_Log_Instance *pLogInst, SOPC_Log_Level level, const char *format,...) |
void | SOPC_Log_VTrace (SOPC_Log_Instance *pLogInst, SOPC_Log_Level level, const char *format, va_list args) |
void | SOPC_Log_ClearInstance (SOPC_Log_Instance **ppLogInst) |
void | SOPC_Log_Clear (void) |
A log manager providing circular logging, multiple logging categories and levels with thread-safe accesses.
typedef struct SOPC_Log_Instance SOPC_Log_Instance |
typedef void SOPC_Log_UserDoLog(const char *category, const char *const line) |
Log event callback.
[in] | category | String pointer containing the category. Can be NULL, when not related to any category, |
[in] | line | Non-null string pointer, containing the full log line, including NULL-terminating character but excluding any newline character, so that it can be specificly defined for each platform. The line has already been filtered (level) and formatted by logger core. In all cases, the line is truncated to SOPC_Log_UserMaxLogLen characters. |
structure containing the file system log configuration
structure containing the user system log configuration
typedef enum SOPC_Log_System SOPC_Log_System |
log system discriminant
typedef union SOPC_Log_SystemConfiguration SOPC_Log_SystemConfiguration |
Provides possible logging configurations.
typedef struct SOPC_Log_Configuration SOPC_Log_Configuration |
Defines logging configuration.
enum SOPC_Log_Level |
enum SOPC_Log_System |
void SOPC_Log_Initialize | ( | void | ) |
Initializes the logger manager: generate unique file name prefix for execution. This prefix is only relevant when the logging feature is set to default file logging. Only the first call is taken into account. Further call will be ignored until next call to :: SOPC_Log_Clear.
SOPC_Log_Instance* SOPC_Log_CreateFileInstance | ( | const char * | logDirPath, |
const char * | logFileName, | ||
const char * | category, | ||
uint32_t | maxBytes, | ||
uint16_t | maxFiles | ||
) |
Creates a new log file and log instance and prints the starting timestamp.
logDirPath | Absolute or relative path of the directory to be used for logs (shall exist and terminate with directory separator) |
logFileName | The file name to be used without extension. A prefix, an integer suffix and extension will be added automatically. |
category | A category name if the log file is used for several categories or NULL. Truncated if more than 9 characters. |
maxBytes | A maximum amount of bytes by log file before opening a new file incrementing the integer suffix. It is a best effort value (amount verified after each print). |
maxFiles | A maximum number of files to be used, when reached the older log file is overwritten (starting with *_00001.log) |
SOPC_Log_Instance* SOPC_Log_CreateUserInstance | ( | const char * | category, |
SOPC_Log_UserDoLog * | logCallback | ||
) |
SOPC_Log_Instance* SOPC_Log_CreateInstanceAssociation | ( | SOPC_Log_Instance * | pLogInst, |
const char * | category | ||
) |
bool SOPC_Log_SetLogLevel | ( | SOPC_Log_Instance * | pLogInst, |
SOPC_Log_Level | level | ||
) |
SOPC_Log_Level SOPC_Log_GetLogLevel | ( | SOPC_Log_Instance * | pLogInst | ) |
bool SOPC_Log_SetConsoleOutput | ( | SOPC_Log_Instance * | pLogInst, |
bool | activate | ||
) |
char* SOPC_Log_GetFilePathPrefix | ( | SOPC_Log_Instance * | pLogInst | ) |
void SOPC_Log_Trace | ( | SOPC_Log_Instance * | pLogInst, |
SOPC_Log_Level | level, | ||
const char * | format, | ||
... | |||
) |
void SOPC_Log_VTrace | ( | SOPC_Log_Instance * | pLogInst, |
SOPC_Log_Level | level, | ||
const char * | format, | ||
va_list | args | ||
) |
void SOPC_Log_ClearInstance | ( | SOPC_Log_Instance ** | ppLogInst | ) |
void SOPC_Log_Clear | ( | void | ) |