S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_logger.h File Reference

Specialized logger for the Toolkit. More...

#include <stdbool.h>
#include <stdint.h>
#include "sopc_log_manager.h"

Go to the source code of this file.

Macros

#define ATTR_FORMAT(archetype, string_index, first)
 
#define LOGGER_FUNC_FORMAT_ENUM   ATTR_FORMAT(printf, 2, 3)
 
#define LOGGER_FUNC_FORMAT   ATTR_FORMAT(printf, 1, 2)
 

Typedefs

typedef enum SOPC_Log_Module SOPC_Log_Module
 enumerate to define log modules
 

Enumerations

enum  SOPC_Log_Module { SOPC_LOG_MODULE_COMMON , SOPC_LOG_MODULE_CLIENTSERVER , SOPC_LOG_MODULE_PUBSUB }
 enumerate to define log modules More...
 

Functions

bool SOPC_Logger_Initialize (const SOPC_Log_Configuration *const logConfiguration)
 Initializes the logger system.
 
SOPC_Log_InstanceSOPC_Logger_AddUserInstance (const char *category)
 Add a user instance in the existing Toolkit log. The new created instance is managed by SOPC_Logger and does not need to be deleted by caller.
 
void SOPC_Logger_SetTraceLogLevel (SOPC_Log_Level level)
 Defines the active log level for the given log instance (default: ERROR):
 
SOPC_Log_Level SOPC_Logger_GetTraceLogLevel (void)
 getter for the log level
 
void SOPC_Logger_SetConsoleOutput (bool activate)
 Activates the console output for logged traces (same active level as log file)
 
void SOPC_Logger_TraceError (SOPC_Log_Module logModule, const char *format,...) LOGGER_FUNC_FORMAT_ENUM
 Log a trace with the error level.
 
void SOPC_Logger_TraceWarning (SOPC_Log_Module logModule, const char *format,...) LOGGER_FUNC_FORMAT_ENUM
 Log a trace with the warning level.
 
void SOPC_Logger_TraceInfo (SOPC_Log_Module logModule, const char *format,...) LOGGER_FUNC_FORMAT_ENUM
 Log a trace with the info level.
 
void SOPC_Logger_TraceDebug (SOPC_Log_Module logModule, const char *format,...) LOGGER_FUNC_FORMAT_ENUM
 
void SOPC_Logger_TraceSecurityAudit (const char *format,...) LOGGER_FUNC_FORMAT
 Log a trace for the security audit log.
 
void SOPC_Logger_TraceSecurityAuditWarning (const char *format,...) LOGGER_FUNC_FORMAT
 Log a warning trace for the security audit log.
 
void SOPC_Logger_TraceOpcUaAudit (const char *format,...) LOGGER_FUNC_FORMAT
 Log a trace for the OPC UA audit log.
 
void SOPC_Logger_TraceOpcUaAuditWarning (const char *format,...) LOGGER_FUNC_FORMAT
 Log a warning trace for the OPC UA audit log.
 
void SOPC_Logger_Clear (void)
 Clears the logger and close the current log files.
 

Detailed Description

Specialized logger for the Toolkit.

Macro Definition Documentation

◆ ATTR_FORMAT

#define ATTR_FORMAT ( archetype,
string_index,
first )

◆ LOGGER_FUNC_FORMAT_ENUM

#define LOGGER_FUNC_FORMAT_ENUM   ATTR_FORMAT(printf, 2, 3)

◆ LOGGER_FUNC_FORMAT

#define LOGGER_FUNC_FORMAT   ATTR_FORMAT(printf, 1, 2)

Typedef Documentation

◆ SOPC_Log_Module

enumerate to define log modules

Enumeration Type Documentation

◆ SOPC_Log_Module

enumerate to define log modules

Enumerator
SOPC_LOG_MODULE_COMMON 

Common log module

SOPC_LOG_MODULE_CLIENTSERVER 

ClientServer log module

SOPC_LOG_MODULE_PUBSUB 

PubSub log module

Function Documentation

◆ SOPC_Logger_Initialize()

bool SOPC_Logger_Initialize ( const SOPC_Log_Configuration *const logConfiguration)

Initializes the logger system.

Parameters
logConfigurationGlobal log configuration

◆ SOPC_Logger_AddUserInstance()

SOPC_Log_Instance * SOPC_Logger_AddUserInstance ( const char * category)

Add a user instance in the existing Toolkit log. The new created instance is managed by SOPC_Logger and does not need to be deleted by caller.

Parameters
categoryThe new user category name.
Postcondition
Caller can use SOPC_Log_xxx features with returned object. In particular the level is filtered out by SOPC_Log_SetLogLevel and not SOPC_Logger_SetTraceLogLevel

◆ SOPC_Logger_SetTraceLogLevel()

void SOPC_Logger_SetTraceLogLevel ( SOPC_Log_Level level)

Defines the active log level for the given log instance (default: ERROR):

  • ERROR: display only ERROR level
  • WARNING: display ERROR + WARNING levels
  • INFO: display ERROR + WARNING + INFO levels
  • DEBUG: display ERROR + WARNING + INFO + DEBUG levels
Parameters
levelThe level to be activated for the log instance

◆ SOPC_Logger_GetTraceLogLevel()

SOPC_Log_Level SOPC_Logger_GetTraceLogLevel ( void )

getter for the log level

Returns
the trace log level

◆ SOPC_Logger_SetConsoleOutput()

void SOPC_Logger_SetConsoleOutput ( bool activate)

Activates the console output for logged traces (same active level as log file)

Parameters
activateFlag to activate / deactivate the console output

◆ SOPC_Logger_TraceError()

void SOPC_Logger_TraceError ( SOPC_Log_Module logModule,
const char * format,
... )

Log a trace with the error level.

Parameters
logModuleThe log module
formatString specifying how subsequent arguments are converted for output

◆ SOPC_Logger_TraceWarning()

void SOPC_Logger_TraceWarning ( SOPC_Log_Module logModule,
const char * format,
... )

Log a trace with the warning level.

Parameters
logModuleThe log module
formatString specifying how subsequent arguments are converted for output

◆ SOPC_Logger_TraceInfo()

void SOPC_Logger_TraceInfo ( SOPC_Log_Module logModule,
const char * format,
... )

Log a trace with the info level.

Parameters
logModuleThe log module
formatString specifying how subsequent arguments are converted for output

◆ SOPC_Logger_TraceDebug()

void SOPC_Logger_TraceDebug ( SOPC_Log_Module logModule,
const char * format,
... )

◆ SOPC_Logger_TraceSecurityAudit()

void SOPC_Logger_TraceSecurityAudit ( const char * format,
... )

Log a trace for the security audit log.

Parameters
formatString specifying how subsequent arguments are converted for output

◆ SOPC_Logger_TraceSecurityAuditWarning()

void SOPC_Logger_TraceSecurityAuditWarning ( const char * format,
... )

Log a warning trace for the security audit log.

Parameters
formatString specifying how subsequent arguments are converted for output

◆ SOPC_Logger_TraceOpcUaAudit()

void SOPC_Logger_TraceOpcUaAudit ( const char * format,
... )

Log a trace for the OPC UA audit log.

Parameters
formatString specifying how subsequent arguments are converted for output

◆ SOPC_Logger_TraceOpcUaAuditWarning()

void SOPC_Logger_TraceOpcUaAuditWarning ( const char * format,
... )

Log a warning trace for the OPC UA audit log.

Parameters
formatString specifying how subsequent arguments are converted for output

◆ SOPC_Logger_Clear()

void SOPC_Logger_Clear ( void )

Clears the logger and close the current log files.