blob: a3c27986aa3804ea3bd6939c3f08fd813e6911ee (
plain) (
blame)
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
45
46
47
48
49
50
|
#include "log.h"
int log_register_sub(int sub, int level, int loc, char *location)
{
FILE *fd=NULL;
if ((sub < LOG_SUB_NONE) || (sub > LOG_SUB_NET))
{
printf("Cant register logging\n");
return -1;
}
if (loc == LOG_LOC_FILE)
{
fd = fopen(location, "a");
if (fd == NULL)
{
printf("Cant open file for logging %s\n", location);
return -1;
}
}
__logs[sub].disabled = 0;
__logs[sub].sub = sub;
__logs[sub].level = level;
__logs[sub].location = loc;
__logs[sub].fd = fd;
__logs[sub].fname = location;
return 0;
}
int log_init()
{
int i;
for (i=0;i<NUM_OF_LOG;i++)
{
__logs[i].disabled = 1;
__logs[i].sub = LOG_SUB_NONE;
__logs[i].level = LOG_LEVEL_NONE;
__logs[i].location = LOG_LOC_STDIO;
__logs[i].fd = stdout;
__logs[i].fname = NULL;
}
return 0;
}
|