S2OPC OPCUA Toolkit
Loading...
Searching...
No Matches
sopc_logger.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_LOGGER_H_
27#define SOPC_LOGGER_H_
28
29#include <stdbool.h>
30#include <stdint.h>
31
32#include "sopc_log_manager.h"
33
34#ifdef __GNUC__
35#define ATTR_FORMAT(archetype, string_index, first) __attribute__((format(archetype, string_index, first)))
36#else
37#define ATTR_FORMAT(archetype, string_index, first)
38#endif
39
40#define LOGGER_FUNC_FORMAT_ENUM ATTR_FORMAT(printf, 2, 3)
41#define LOGGER_FUNC_FORMAT ATTR_FORMAT(printf, 1, 2)
42
52
59bool SOPC_Logger_Initialize(const SOPC_Log_Configuration* const logConfiguration);
60
69
80
87
93void SOPC_Logger_SetConsoleOutput(bool activate);
94
101void SOPC_Logger_TraceError(SOPC_Log_Module logModule, const char* format, ...) LOGGER_FUNC_FORMAT_ENUM;
102
109void SOPC_Logger_TraceWarning(SOPC_Log_Module logModule, const char* format, ...) LOGGER_FUNC_FORMAT_ENUM;
110
117void SOPC_Logger_TraceInfo(SOPC_Log_Module logModule, const char* format, ...) LOGGER_FUNC_FORMAT_ENUM;
118
119/*
120 * \brief Log a trace with the debug level
121 *
122 * \param logModule The log module
123 * \param format String specifying how subsequent arguments are converted for output
124 */
125void SOPC_Logger_TraceDebug(SOPC_Log_Module logModule, const char* format, ...) LOGGER_FUNC_FORMAT_ENUM;
126
133
140
147
154
159
160#endif /* SOPC_LOGGER_H_ */
Provide circular logging.
struct SOPC_Log_Instance SOPC_Log_Instance
Definition sopc_log_manager.h:35
SOPC_Log_Level
Definition sopc_log_manager.h:38
void SOPC_Logger_TraceSecurityAudit(const char *format,...) LOGGER_FUNC_FORMAT
Log a trace for the security audit log.
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_TraceSecurityAuditWarning(const char *format,...) LOGGER_FUNC_FORMAT
Log a warning trace for the security audit log.
SOPC_Log_Level SOPC_Logger_GetTraceLogLevel(void)
getter for the log level
SOPC_Log_Module
enumerate to define log modules
Definition sopc_logger.h:47
@ SOPC_LOG_MODULE_PUBSUB
Definition sopc_logger.h:50
@ SOPC_LOG_MODULE_COMMON
Definition sopc_logger.h:48
@ SOPC_LOG_MODULE_CLIENTSERVER
Definition sopc_logger.h:49
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 a...
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_TraceOpcUaAuditWarning(const char *format,...) LOGGER_FUNC_FORMAT
Log a warning trace for the OPC UA audit log.
#define LOGGER_FUNC_FORMAT
Definition sopc_logger.h:41
void SOPC_Logger_SetConsoleOutput(bool activate)
Activates the console output for logged traces (same active level as log file)
bool SOPC_Logger_Initialize(const SOPC_Log_Configuration *const logConfiguration)
Initializes the logger system.
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_TraceOpcUaAudit(const char *format,...) LOGGER_FUNC_FORMAT
Log a trace for the OPC UA audit log.
void SOPC_Logger_SetTraceLogLevel(SOPC_Log_Level level)
Defines the active log level for the given log instance (default: ERROR):
#define LOGGER_FUNC_FORMAT_ENUM
Definition sopc_logger.h:40
void SOPC_Logger_Clear(void)
Clears the logger and close the current log files.
Defines logging configuration.
Definition sopc_log_manager.h:103