summaryrefslogtreecommitdiff
path: root/other/bootstrap_daemon/src/log.h
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2016-01-04 22:43:36 -0500
committerirungentoo <irungentoo@gmail.com>2016-01-04 22:43:36 -0500
commitc6bed82d47aa39709bdd568fccc3847714ed1b74 (patch)
tree4e2dd8676a53e78a5b84e3abd68cdbe82a636737 /other/bootstrap_daemon/src/log.h
parent760f20c9455c2ef33ec9d242f209a1543f6acaf4 (diff)
parent9d1efd594914629204d4cd1a84678daf67eb8068 (diff)
Merge branch 'tox-bootstrapd-docker-support' of https://github.com/nurupo/InsertProjectNameHere
Diffstat (limited to 'other/bootstrap_daemon/src/log.h')
-rw-r--r--other/bootstrap_daemon/src/log.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/other/bootstrap_daemon/src/log.h b/other/bootstrap_daemon/src/log.h
new file mode 100644
index 00000000..61cb2ee3
--- /dev/null
+++ b/other/bootstrap_daemon/src/log.h
@@ -0,0 +1,64 @@
1/* log.h
2 *
3 * Tox DHT bootstrap daemon.
4 * Logging utility with support of multipel logging backends.
5 *
6 * Copyright (C) 2015-2016 Tox project All Rights Reserved.
7 *
8 * This file is part of Tox.
9 *
10 * Tox is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14 *
15 * Tox is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with Tox. If not, see <http://www.gnu.org/licenses/>.
22 *
23 */
24
25#ifndef LOG_H
26#define LOG_H
27
28#include <stdbool.h>
29
30typedef enum LOG_BACKEND {
31 LOG_BACKEND_SYSLOG,
32 LOG_BACKEND_STDOUT
33} LOG_BACKEND;
34
35typedef enum LOG_LEVEL {
36 LOG_LEVEL_INFO,
37 LOG_LEVEL_WARNING,
38 LOG_LEVEL_ERROR
39} LOG_LEVEL;
40
41/**
42 * Initializes logger.
43 * @param backend Specifies which backend to use.
44 * @return true on success, flase if log is already opened.
45 */
46bool open_log(LOG_BACKEND backend);
47
48/**
49 * Releases all used resources by the logger.
50 * @return true on success, flase if log is already closed.
51 */
52bool close_log();
53
54/**
55 * Writes a message to the log.
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 * @return true on success, flase if log is closed.
60 */
61bool write_log(LOG_LEVEL level, const char *format, ...);
62
63
64#endif // LOG_H