blob: df1ae6abcd7764fa7a29d6d2f99ff134e51044ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
/* log.c
* (c) Jonas Gunz, 2019
* License: MIT
* */
#include "log.h"
const char* log_loglevel_str[5] = {
"---",
"ERROR",
"WARNING",
"NOTE",
"DEBUG"
};
int log_init_file(char* _file, unsigned int _verbosity)
{
log_fd = open(_file, O_WRONLY | O_APPEND | O_CREAT | O_DSYNC);
return log_init_stdout(_verbosity);;
}
int log_init_stdout(unsigned int _verbosity)
{
log_loglevel = _verbosity;// > _LOG_DEBUG ? _LOG_DEBUG : _verbosity;
log_fd = STDIN_FILENO;
LOGPRINTF(0, "=== RESTART ===");
LOGPRINTF(0, "Verbosity: %i", _verbosity);
return 0;
}
int log_close()
{
return close(log_fd);
}
|