introduced new logging subsystem using bus:
[strongswan.git] / src / charon / bus / listeners / file_logger.h
1 /**
2 * @file file_logger.h
3 *
4 * @brief Interface of file_logger_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2006 Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #ifndef FILE_LOGGER_H_
24 #define FILE_LOGGER_H_
25
26 #include <bus/bus.h>
27
28
29 typedef struct file_logger_t file_logger_t;
30
31 /**
32 * @brief Logger to files which implements bus_listener_t.
33 *
34 * @b Constructors:
35 * - file_logger_create()
36 *
37 * @ingroup listeners
38 */
39 struct file_logger_t {
40
41 /**
42 * Implements the bus_listener_t interface.
43 */
44 bus_listener_t listener;
45
46 /**
47 * @brief Set the loglevel for a signal type.
48 *
49 * @param this stream_logger_t object
50 * @param singal type of signal
51 * @param level max level to log (0..4)
52 */
53 void (*set_level) (file_logger_t *this, signal_t signal, level_t level);
54
55 /**
56 * @brief Destroys a file_logger_t object.
57 *
58 * @param this file_logger_t object
59 */
60 void (*destroy) (file_logger_t *this);
61 };
62
63 /**
64 * @brief Constructor to create a file_logger_t object.
65 *
66 * @param out FILE to write to
67 * @return file_logger_t object
68 *
69 * @ingroup listeners
70 */
71 file_logger_t *file_logger_create(FILE *out);
72
73
74 #endif /* FILE_LOGGER_H_ */