CAEN Utility  2.0.2
Utilities for CAEN projects
CAENLogger.h
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * CAEN SpA - Software Division
4 * Via Vetraia, 11 - 55049 - Viareggio ITALY
5 * +39 0594 388 398 - www.caen.it
6 *
7 *******************************************************************************
8 *
9 * Copyright (C) 2019-2022 CAEN SpA
10 *
11 * This file is part of the CAEN Utility.
12 *
13 * The CAEN Utility is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 3 of the License, or (at your option) any later version.
17 *
18 * The CAEN Utility is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with the CAEN Utility; if not, see
25 * https://www.gnu.org/licenses/.
26 *
27 * SPDX-License-Identifier: LGPL-3.0-or-later
28 *
29 ***************************************************************************/
37 #ifndef CAEN_INCLUDE_CAENLOGGER_H_
38 #define CAEN_INCLUDE_CAENLOGGER_H_
39 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 #include <types/CAENLoggerTypes.h>
55 #include <CAENUtility.h>
56 #include <stdarg.h>
57 #include <inttypes.h> // includes also stdint.h
58 #include <stdio.h>
59 
60 #define LOG_ENV_FILENAME "CAEN_LOG_FILENAME"
61 #define LOG_ENV_LEVEL "CAEN_LOG_LEVEL"
62 
69 
77 
84 
90 
97 CAEN_UTILITY_DLLAPI int32_t CAEN_UTILITY_API c_lsetsm(uint32_t sevMask);
98 
105 CAEN_UTILITY_DLLAPI int32_t CAEN_UTILITY_API c_lgetsm(uint32_t *sevMask);
106 
117 c_attribute_format(4, 0)
118 CAEN_UTILITY_DLLAPI int32_t CAEN_UTILITY_API c_lvprintf(const c_locallogger_t *locallogger, c_logger_Severity s, int32_t line, const char *__restrict format, va_list args);
119 
130 c_attribute_format(4, 5)
131 CAEN_UTILITY_DLLAPI int32_t CAEN_UTILITY_API c_lprintf(const c_locallogger_t *locallogger, c_logger_Severity s, int32_t line, const char *__restrict format, ...);
132 
139 #define INIT_C_LOGGER(fname, mname) static const c_locallogger_t __locallogger = { (fname), (mname) }
140 
148 #define vlogMsg(s, format, args) c_lvprintf(&(__locallogger), (s), (format), (args))
149 
157 #define logMsg(s, ...) c_lprintf(&(__locallogger), (s), __LINE__, __VA_ARGS__)
158 
159 #ifdef __cplusplus
160 }
161 #endif
162 
163 #endif // CAEN_INCLUDE_CAENLOGGER_H_
void c_lsetst(uint64_t time)
Definition: CAENLogger.c:309
int32_t c_lprintf(const c_locallogger_t *locallogger, c_logger_Severity s, int32_t line, const char *__restrict format,...)
Definition: CAENLogger.c:358
Definitions and types for CAENLogger.h.
int32_t c_lsetsm(uint32_t sevMask)
Definition: CAENLogger.c:345
#define CAEN_UTILITY_API
Definition: CAENUtility.h:104
int32_t c_lchangefile(FILE *file)
Definition: CAENLogger.c:313
FILE * file
Definition: CAENLogger.c:52
Main header and generic tools.
int32_t c_lgetsm(uint32_t *sevMask)
Definition: CAENLogger.c:350
#define c_attribute_format(_FMT_, _ARGS_)
Definition: CAENUtility.h:173
#define CAEN_UTILITY_DLLAPI
Definition: CAENUtility.h:105
void c_ldeinit(void)
Definition: CAENLogger.c:390
int32_t c_lvprintf(const c_locallogger_t *locallogger, c_logger_Severity s, int32_t line, const char *__restrict format, va_list args)
Definition: CAENLogger.c:366
int32_t c_lresumefile(void)
Definition: CAENLogger.c:329
c_logger_Severity