diff options
Diffstat (limited to 'other/bootstrap_daemon/src')
-rw-r--r-- | other/bootstrap_daemon/src/tox-bootstrapd.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/other/bootstrap_daemon/src/tox-bootstrapd.c b/other/bootstrap_daemon/src/tox-bootstrapd.c index 0c18e05a..45c378f6 100644 --- a/other/bootstrap_daemon/src/tox-bootstrapd.c +++ b/other/bootstrap_daemon/src/tox-bootstrapd.c | |||
@@ -178,6 +178,44 @@ static void daemonize(LOG_BACKEND log_backend, char *pid_file_path) | |||
178 | } | 178 | } |
179 | } | 179 | } |
180 | 180 | ||
181 | void print_log(void *context, LOGGER_LEVEL level, const char *file, int line, | ||
182 | const char *func, const char *message, void *userdata) | ||
183 | { | ||
184 | if (MIN_LOGGER_LEVEL != LOG_TRACE && MIN_LOGGER_LEVEL != LOG_DEBUG) { | ||
185 | return; | ||
186 | } | ||
187 | |||
188 | char *strlevel; | ||
189 | |||
190 | switch (level) { | ||
191 | case LOG_TRACE: | ||
192 | strlevel = "TRACE"; | ||
193 | break; | ||
194 | |||
195 | case LOG_DEBUG: | ||
196 | strlevel = "DEBUG"; | ||
197 | break; | ||
198 | |||
199 | case LOG_INFO: | ||
200 | strlevel = "INFO"; | ||
201 | break; | ||
202 | |||
203 | case LOG_WARNING: | ||
204 | strlevel = "WARNING"; | ||
205 | break; | ||
206 | |||
207 | case LOG_ERROR: | ||
208 | strlevel = "ERROR"; | ||
209 | break; | ||
210 | |||
211 | default: | ||
212 | strlevel = "<unknown>"; | ||
213 | break; | ||
214 | } | ||
215 | |||
216 | fprintf(stderr, "[%s] %s:%d(%s) %s\n", strlevel, file, line, func, message); | ||
217 | } | ||
218 | |||
181 | int main(int argc, char *argv[]) | 219 | int main(int argc, char *argv[]) |
182 | { | 220 | { |
183 | umask(077); | 221 | umask(077); |
@@ -231,6 +269,7 @@ int main(int argc, char *argv[]) | |||
231 | ip_init(&ip, enable_ipv6); | 269 | ip_init(&ip, enable_ipv6); |
232 | 270 | ||
233 | Logger *logger = logger_new(); | 271 | Logger *logger = logger_new(); |
272 | logger_callback_log(logger, print_log, nullptr, nullptr); | ||
234 | 273 | ||
235 | Networking_Core *net = new_networking(logger, ip, port); | 274 | Networking_Core *net = new_networking(logger, ip, port); |
236 | 275 | ||