summaryrefslogtreecommitdiff
path: root/toxcore/logger.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-03-17 14:48:34 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-03-17 15:04:03 +0000
commit9706d9a0f015a58937255abd95101045ab865796 (patch)
treef80d6558912e09b22b4f0c44440e54f92fd40cae /toxcore/logger.c
parenta2496af71aeed3cd7324fb59d9f32c2d52759d56 (diff)
Disallow stderr logger by default.
Diffstat (limited to 'toxcore/logger.c')
-rw-r--r--toxcore/logger.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/toxcore/logger.c b/toxcore/logger.c
index 80195e93..ff34f994 100644
--- a/toxcore/logger.c
+++ b/toxcore/logger.c
@@ -27,6 +27,7 @@
27 27
28#include "logger.h" 28#include "logger.h"
29 29
30#include <assert.h>
30#include <stdarg.h> 31#include <stdarg.h>
31#include <stdio.h> 32#include <stdio.h>
32#include <stdlib.h> 33#include <stdlib.h>
@@ -38,7 +39,7 @@ struct Logger {
38 void *userdata; 39 void *userdata;
39}; 40};
40 41
41 42#ifdef USE_STDERR_LOGGER
42static const char *logger_level_name(LOGGER_LEVEL level) 43static const char *logger_level_name(LOGGER_LEVEL level)
43{ 44{
44 switch (level) { 45 switch (level) {
@@ -73,7 +74,7 @@ static const Logger logger_stderr = {
73 nullptr, 74 nullptr,
74 nullptr, 75 nullptr,
75}; 76};
76 77#endif
77 78
78/** 79/**
79 * Public Functions 80 * Public Functions
@@ -99,7 +100,11 @@ void logger_write(const Logger *log, LOGGER_LEVEL level, const char *file, int l
99 const char *format, ...) 100 const char *format, ...)
100{ 101{
101 if (!log) { 102 if (!log) {
103#ifdef USE_STDERR_LOGGER
102 log = &logger_stderr; 104 log = &logger_stderr;
105#else
106 assert(!"NULL logger not permitted");
107#endif
103 } 108 }
104 109
105 if (!log->callback) { 110 if (!log->callback) {