TRIP Routing Daemon
TRIP (RFC 3219) Location Server Implementation
Loading...
Searching...
No Matches
logging.h
Go to the documentation of this file.
1/*
2
3 trip: Modern TRIP LS implementation
4 Copyright (C) 2025 arf20 (Ángel Ruiz Fernandez)
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <https://www.gnu.org/licenses/>.
18
19*/
20
24
25
26#ifndef _LOGGING_H
27#define _LOGGING_H
28
29#include <stdio.h>
30
31
33typedef enum {
34 LOG_ERROR,
35 LOG_WARNING,
36 LOG_INFO,
37 LOG_DEBUG,
38 LOG_TRACE
40
41
43void logging_init(FILE *logf, loglevel_t loglevel);
44
46void logging_log(loglevel_t level, const char *component,
47 const char *format, ...);
48
50void logging_log_debug(loglevel_t level, const char *component,
51 const char *file, const char *func, int line, const char *format,
52 ...);
53
54
56#define ERROR(format, ...) logging_log_debug(LOG_ERROR, _COMPONENT_, \
57 __FILE__, __func__, __LINE__, format, ##__VA_ARGS__);
58
59#define WARNING(format, ...) logging_log(LOG_INFO, _COMPONENT_, format, \
60 ##__VA_ARGS__);
61
62#define INFO(format, ...) logging_log(LOG_INFO, _COMPONENT_, format, \
63 ##__VA_ARGS__);
64
65#define DEBUG(format, ...) logging_log_debug(LOG_DEBUG, _COMPONENT_, \
66 __FILE__, __func__, __LINE__, format, ##__VA_ARGS__);
67
68#define TRACE(format, ...) logging_log_debug(LOG_TRACE, _COMPONENT_, \
69 __FILE__, __func__, __LINE__, format, ##_VA_ARGS__);
70
71#endif /* _LOGGING_H */
72
loglevel_t
error levels
Definition logging.h:33
void logging_log_debug(loglevel_t level, const char *component, const char *file, const char *func, int line, const char *format,...)
log with debug info
Definition logging.c:104
void logging_log(loglevel_t level, const char *component, const char *format,...)
log
Definition logging.c:84
void logging_init(FILE *logf, loglevel_t loglevel)
initialize log file and log level
Definition logging.c:77