summaryrefslogtreecommitdiff
path: root/other/bootstrap_daemon/src/logger.h
diff options
context:
space:
mode:
Diffstat (limited to 'other/bootstrap_daemon/src/logger.h')
-rw-r--r--other/bootstrap_daemon/src/logger.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/other/bootstrap_daemon/src/logger.h b/other/bootstrap_daemon/src/logger.h
new file mode 100644
index 00000000..174d3445
--- /dev/null
+++ b/other/bootstrap_daemon/src/logger.h
@@ -0,0 +1,63 @@
1/* logger.h
2 *
3 * Tox DHT bootstrap daemon.
4 *
5 * Copyright (C) 2015 Tox project All Rights Reserved.
6 *
7 * This file is part of Tox.
8 *
9 * Tox is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * Tox is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
21 *
22 */
23
24#ifndef LOGGER_H
25#define LOGGER_H
26
27typedef enum LOGGER_BACKEND {
28 LOGGER_BACKEND_SYSLOG,
29 LOGGER_BACKEND_STDOUT
30} LOGGER_BACKEND;
31
32typedef enum LOG_LEVEL {
33 LOG_LEVEL_INFO,
34 LOG_LEVEL_WARNING,
35 LOG_LEVEL_ERROR
36} LOG_LEVEL;
37
38typedef struct Logger Logger;
39
40/**
41 * Creates new logger.
42 * @param backend Specifies which backend the logger should use.
43 * @return Logger object on success, NULL on failure.
44 */
45Logger* new_logger(LOGGER_BACKEND backend);
46
47/**
48 * Destroys a logger object, releasing all used resources.
49 * @param logger Logger object to destroy.
50 */
51void kill_logger(Logger* logger);
52
53/**
54 * Logs a message.
55 * @param logger Logger object to use.
56 * @param level Log level to use.
57 * @param format printf-like format string.
58 * @param ... Zero or more arguments, similar to printf function.
59 */
60void log(Logger* logger, LOG_LEVEL level, const char *format, ...);
61
62
63#endif // LOGGER_H