S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_log_manager.h
Go to the documentation of this file.
1/*
2 * Licensed to Systerel under one or more contributor license
3 * agreements. See the NOTICE file distributed with this work
4 * for additional information regarding copyright ownership.
5 * Systerel licenses this file to you under the Apache
6 * License, Version 2.0 (the "License"); you may not use this
7 * file except in compliance with the License. You may obtain
8 * a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
26#ifndef SOPC_LOG_MANAGER_H_
27#define SOPC_LOG_MANAGER_H_
28
29#include <stdarg.h>
30#include <stdbool.h>
31#include <stdint.h>
32
34
36
44
57typedef void SOPC_Log_UserDoLog(const char* timestampUtc,
58 const char* category,
59 const SOPC_Log_Level level,
60 const char* const line);
61
71
79
89
98
108
119
130
142
143/*
144 * \brief Defines the active log level for the given log instance (default: ERROR):
145 * - ERROR: display only ERROR level
146 * - WARNING: display ERROR + WARNING levels
147 * - INFO: display ERROR + WARNING + INFO levels
148 * - DEBUG: display ERROR + WARNING + INFO + DEBUG levels
149 *
150 * \param pLogInst An existing log instance
151 * \param level The level to be activated for the log instance
152 */
154
163
170bool SOPC_Log_SetConsoleOutput(SOPC_Log_Instance* pLogInst, bool activate);
171
179
187void SOPC_Log_Trace(SOPC_Log_Instance* pLogInst, SOPC_Log_Level level, const char* format, ...);
188
197void SOPC_Log_VTrace(SOPC_Log_Instance* pLogInst, SOPC_Log_Level level, const char* format, va_list args);
198
205
206#endif /* SOPC_LOG_MANAGER_H_ */
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.
union SOPC_Log_SystemConfiguration SOPC_Log_SystemConfiguration
Provides possible logging configurations.
struct SOPC_Log_Instance SOPC_Log_Instance
Definition sopc_log_manager.h:35
void SOPC_Log_Trace(SOPC_Log_Instance *pLogInst, SOPC_Log_Level level, const char *format,...)
Logs a trace with the given level.
struct SOPC_Log_Configuration SOPC_Log_Configuration
Defines logging configuration.
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 ...
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_UserDoLog(const char *timestampUtc, const char *category, const SOPC_Log_Level level, const char *const line)
Log event callback.
Definition sopc_log_manager.h:57
SOPC_Log_Level
Definition sopc_log_manager.h:38
@ SOPC_LOG_LEVEL_ERROR
Definition sopc_log_manager.h:39
@ SOPC_LOG_LEVEL_WARNING
Definition sopc_log_manager.h:40
@ SOPC_LOG_LEVEL_DEBUG
Definition sopc_log_manager.h:42
@ SOPC_LOG_LEVEL_INFO
Definition sopc_log_manager.h:41
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...
SOPC_Log_Instance * SOPC_Log_CreateUserInstance(const char *category, SOPC_Log_UserDoLog *logCallback)
Creates a new log instance for user mode.
SOPC_Log_Level SOPC_Log_GetLogLevel(SOPC_Log_Instance *pLogInst)
getter for the log level of an instance
SOPC_Log_System
log system discriminant
Definition sopc_log_manager.h:84
@ SOPC_LOG_SYSTEM_FILE
Definition sopc_log_manager.h:85
@ SOPC_LOG_SYSTEM_NO_LOG
Definition sopc_log_manager.h:87
@ SOPC_LOG_SYSTEM_USER
Definition sopc_log_manager.h:86
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.
struct SOPC_LogSystem_File_Configuration SOPC_LogSystem_File_Configuration
structure containing the file log configuration
bool SOPC_Log_SetLogLevel(SOPC_Log_Instance *pLogInst, SOPC_Log_Level level)
struct SOPC_LogSystem_User_Configuration SOPC_LogSystem_User_Configuration
structure containing the user system log configuration
structure containing the file system log configuration
Definition sopc_circular_log_file.h:39
structure containing the file log configuration
Definition sopc_log_manager.h:66
uint32_t logMaxBytes
Definition sopc_log_manager.h:68
const char * logDirPath
Definition sopc_log_manager.h:67
uint16_t logMaxFiles
Definition sopc_log_manager.h:69
structure containing the user system log configuration
Definition sopc_log_manager.h:76
SOPC_Log_UserDoLog * doLog
Definition sopc_log_manager.h:77
Defines logging configuration.
Definition sopc_log_manager.h:103
SOPC_Log_Level logLevel
Definition sopc_log_manager.h:104
SOPC_Log_System logSystem
Definition sopc_log_manager.h:105
SOPC_Log_SystemConfiguration logSysConfig
Definition sopc_log_manager.h:106
Provides possible logging configurations.
Definition sopc_log_manager.h:94
SOPC_LogSystem_File_Configuration fileSystemLogConfig
Definition sopc_log_manager.h:95
SOPC_LogSystem_User_Configuration userSystemLogConfig
Definition sopc_log_manager.h:96