""
[strongswan.git] / Source / charon / logger.h
1 /**
2 * @file logger.h
3 *
4 * @brief Logger object, allows fine-controlled logging
5 *
6 */
7
8 /*
9 * Copyright (C) 2005 Jan Hutter, 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 LOGGER_H_
24 #define LOGGER_H_
25
26 #include "types.h"
27
28
29 typedef enum logger_level_e logger_level_t;
30 enum logger_level_e {
31 CONTROL = 1,
32 CONTROL_MORE = 2,
33 RAW = 4,
34 PRIVATE = 8
35 };
36
37
38
39
40 /**
41 * @brief The logger object
42 */
43 typedef struct logger_s logger_t;
44 struct logger_s {
45 status_t (*log) (logger_t *this, logger_level_t loglevel, char *format, ...);
46
47 status_t (*enable_level) (logger_t *this, logger_level_t log_level);
48
49 status_t (*disable_level) (logger_t *this, logger_level_t log_level);
50
51 /**
52 * @brief Destroys a generator object
53 *
54 * @param generator generator object
55 * @return SUCCESSFUL if succeeded, FAILED otherwise
56 */
57 status_t (*destroy) (logger_t *this);
58 };
59
60 /**
61 * Constructor to create a logger
62 *
63 */
64 logger_t *logger_create(char *logger_name, char *file, logger_level_t log_level);
65
66 #endif /*LOGGER_H_*/
67