aboutsummaryrefslogtreecommitdiff
path: root/src/log.c
blob: 8e779a50e486c4a49764a90a807144eb72e1a5b9 (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
38
39
40
41
42
43
44
/* log.c
 * (c) Jonas Gunz, 2019
 * License: MIT
 * */

#include "log.h"

unsigned int log_loglevel;
int log_fd;

const char* log_loglevel_str[6] = {
	"---",
	"ERROR",
	"ERROR",
	"WARNING",
	"NOTE",
	"DEBUG"
};

int log_init_file(char* _file, unsigned int _verbosity)
{
	return -1;
	/*
	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);
}