S2OPC OPCUA Toolkit
|
Provide circular logging. More...
Go to the source code of this file.
Data Structures | |
struct | SOPC_LogSystem_File_Configuration |
structure containing the file 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 enum SOPC_Log_Level | SOPC_Log_Level |
typedef void | SOPC_Log_UserDoLog(const char *timestampUtc, const char *category, const SOPC_Log_Level level, const char *const line) |
Log event callback. | |
typedef struct SOPC_LogSystem_File_Configuration | SOPC_LogSystem_File_Configuration |
structure containing the file log configuration | |
typedef struct SOPC_LogSystem_User_Configuration | SOPC_LogSystem_User_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. | |
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 } |
enum | SOPC_Log_System { SOPC_LOG_SYSTEM_FILE , SOPC_LOG_SYSTEM_USER , SOPC_LOG_SYSTEM_NO_LOG } |
log system discriminant More... | |
Functions | |
SOPC_Log_Instance * | SOPC_Log_CreateFileInstance (const SOPC_CircularLogFile_Configuration *pConf, const char *category) |
Creates a new log file and log instance and prints the starting timestamp. | |
SOPC_Log_Instance * | SOPC_Log_CreateUserInstance (const char *category, SOPC_Log_UserDoLog *logCallback) |
Creates a new log instance for user mode. | |
SOPC_Log_Instance * | SOPC_Log_CreateInstanceAssociation (SOPC_Log_Instance *pLogInst, const char *category) |
Creates a new log instance using the same log file than existing log instance and prints the starting timestamp. It provides the way to have several categories with different levels of log in the same log file. | |
bool | SOPC_Log_SetLogLevel (SOPC_Log_Instance *pLogInst, SOPC_Log_Level level) |
SOPC_Log_Level | SOPC_Log_GetLogLevel (SOPC_Log_Instance *pLogInst) |
getter for the log level of an instance | |
bool | SOPC_Log_SetConsoleOutput (SOPC_Log_Instance *pLogInst, bool activate) |
Activates the console output for logged traces (same active level as log file) | |
char * | SOPC_Log_GetCurrentFilename (const SOPC_Log_Instance *pLogInst) |
Get the name of the current log file. | |
void | SOPC_Log_Trace (SOPC_Log_Instance *pLogInst, SOPC_Log_Level level, const char *format,...) |
Logs a trace with the given level. | |
void | SOPC_Log_VTrace (SOPC_Log_Instance *pLogInst, SOPC_Log_Level level, const char *format, va_list args) |
Logs a trace with the given level. | |
void | SOPC_Log_ClearInstance (SOPC_Log_Instance **ppLogInst) |
Stops allowing to log traces in the given log instance. Log file is closed when last log instance is stopped. | |
Provide circular logging.
A log manager providing circular logging, multiple logging categories and levels with thread-safe accesses.
typedef struct SOPC_Log_Instance SOPC_Log_Instance |
typedef enum SOPC_Log_Level SOPC_Log_Level |
typedef void SOPC_Log_UserDoLog(const char *timestampUtc, const char *category, const SOPC_Log_Level level, const char *const line) |
Log event callback.
[in] | timestampUtc | String pointer containing the event timestamp (UTC time) |
[in] | category | String pointer containing the category. Can be NULL, when not related to any category, |
[in] | level | The level of the log (Already filtered out if below current log level), |
[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. |
typedef struct SOPC_LogSystem_File_Configuration SOPC_LogSystem_File_Configuration |
structure containing the file log configuration
typedef struct SOPC_LogSystem_User_Configuration SOPC_LogSystem_User_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 |
SOPC_Log_Instance * SOPC_Log_CreateFileInstance | ( | const SOPC_CircularLogFile_Configuration * | pConf, |
const char * | category ) |
Creates a new log file and log instance and prints the starting timestamp.
pConf | A non-NULL pointer to the file instance configuration |
category | A category name if the log file is used for several categories or NULL. Truncated if more than 9 characters. |
SOPC_Log_Instance * SOPC_Log_CreateUserInstance | ( | const char * | category, |
SOPC_Log_UserDoLog * | logCallback ) |
Creates a new log instance for user mode.
category | A category name if the log file is used for several categories or NULL. Truncated if more than 9 characters. |
logCallback | The user logging callback. If set to NULL, no user event is called. |
SOPC_Log_Instance * SOPC_Log_CreateInstanceAssociation | ( | SOPC_Log_Instance * | pLogInst, |
const char * | category ) |
Creates a new log instance using the same log file than existing log instance and prints the starting timestamp. It provides the way to have several categories with different levels of log in the same log file.
pLogInst | An existing log instance used to print in the same log file |
category | Category for the new log instance in the log file (should be unique in log file) |
bool SOPC_Log_SetLogLevel | ( | SOPC_Log_Instance * | pLogInst, |
SOPC_Log_Level | level ) |
SOPC_Log_Level SOPC_Log_GetLogLevel | ( | SOPC_Log_Instance * | pLogInst | ) |
getter for the log level of an instance
pLogInst | An existing log instance |
bool SOPC_Log_SetConsoleOutput | ( | SOPC_Log_Instance * | pLogInst, |
bool | activate ) |
Activates the console output for logged traces (same active level as log file)
pLogInst | An existing log instance |
activate | Flag to activate / deactivate the console output |
char * SOPC_Log_GetCurrentFilename | ( | const SOPC_Log_Instance * | pLogInst | ) |
Get the name of the current log file.
pLogInst | An existing log instance |
void SOPC_Log_Trace | ( | SOPC_Log_Instance * | pLogInst, |
SOPC_Log_Level | level, | ||
const char * | format, | ||
... ) |
Logs a trace with the given level.
pLogInst | An existing log instance already started |
level | The log level corresponding to the given trace |
format | String specifying how subsequent arguments are converted for output |
void SOPC_Log_VTrace | ( | SOPC_Log_Instance * | pLogInst, |
SOPC_Log_Level | level, | ||
const char * | format, | ||
va_list | args ) |
Logs a trace with the given level.
pLogInst | An existing log instance already started |
level | The log level corresponding to the given trace |
format | String specifying how subsequent arguments are converted for output |
args | Arguments used by the string specifying the output |
void SOPC_Log_ClearInstance | ( | SOPC_Log_Instance ** | ppLogInst | ) |
Stops allowing to log traces in the given log instance. Log file is closed when last log instance is stopped.
ppLogInst | An existing log instance already started. Pointer set to NULL after call. |