]>
Commit | Line | Data |
---|---|---|
47f50278 | 1 | /* |
b422f16d | 2 | * Copyright (C) 2012-2020 Tobias Brunner |
47f50278 | 3 | * Copyright (C) 2006 Martin Willi |
19ef2aec TB |
4 | * |
5 | * Copyright (C) secunet Security Networks AG | |
47f50278 MW |
6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | |
8 | * under the terms of the GNU General Public License as published by the | |
9 | * Free Software Foundation; either version 2 of the License, or (at your | |
10 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, but | |
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 | * for more details. | |
552cc11b MW |
16 | */ |
17 | ||
18 | /** | |
19 | * @defgroup sys_logger sys_logger | |
20 | * @{ @ingroup listeners | |
47f50278 MW |
21 | */ |
22 | ||
23 | #ifndef SYS_LOGGER_H_ | |
24 | #define SYS_LOGGER_H_ | |
25 | ||
0e474f91 | 26 | #include <bus/listeners/logger.h> |
a40cc76b MW |
27 | |
28 | typedef struct sys_logger_t sys_logger_t; | |
47f50278 | 29 | |
47f50278 | 30 | /** |
a985db3f | 31 | * Logger for syslog which implements listener_t. |
47f50278 MW |
32 | */ |
33 | struct sys_logger_t { | |
7daf5226 | 34 | |
47f50278 | 35 | /** |
0e474f91 | 36 | * Implements the logger_t interface. |
47f50278 | 37 | */ |
0e474f91 | 38 | logger_t logger; |
7daf5226 | 39 | |
47f50278 | 40 | /** |
a985db3f | 41 | * Set the loglevel for a debug group. |
47f50278 | 42 | * |
a985db3f MW |
43 | * @param group debug group to set |
44 | * @param level max level to log (0..4) | |
47f50278 | 45 | */ |
a985db3f | 46 | void (*set_level) (sys_logger_t *this, debug_t group, level_t level); |
7daf5226 | 47 | |
d35d6691 TB |
48 | /** |
49 | * Set options used by this logger. | |
50 | * | |
51 | * @param ike_name TRUE to prefix the name of the IKE_SA | |
b422f16d | 52 | * @param log_level TRUE to include the log level in the message |
9877ce6c | 53 | * @param map_level map log level to syslog level, -1 to disable |
d35d6691 | 54 | */ |
9877ce6c MW |
55 | void (*set_options) (sys_logger_t *this, bool ike_name, bool log_level, |
56 | int map_level); | |
d35d6691 | 57 | |
47f50278 | 58 | /** |
552cc11b | 59 | * Destroys a sys_logger_t object. |
47f50278 MW |
60 | */ |
61 | void (*destroy) (sys_logger_t *this); | |
62 | }; | |
63 | ||
64 | /** | |
552cc11b | 65 | * Constructor to create a sys_logger_t object. |
47f50278 MW |
66 | * |
67 | * @param facility syslog facility to use | |
68 | * @return sys_logger_t object | |
47f50278 | 69 | */ |
d35d6691 | 70 | sys_logger_t *sys_logger_create(int facility); |
47f50278 | 71 | |
1490ff4d | 72 | #endif /** SYS_LOGGER_H_ @}*/ |