-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.c
34 lines (29 loc) · 858 Bytes
/
log.c
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
/*
https://crypto.bi/cavax/
*/
#include "cavax/log.h"
#include <stdio.h>
#include <time.h>
void cavax_log(const char *msg, enum cavax_log_message_type_e typ) {
time_t t;
struct tm *info;
time(&t);
info = localtime(&t);
char *sinfo = asctime(info);
switch (typ) {
case CAVAX_MESSAGE_INFO:
printf("%s INFO: %s", sinfo, msg);
break;
case CAVAX_MESSAGE_ERROR:
fprintf(stderr, "%s DEBUG %s", sinfo, msg);
break;
case CAVAX_MESSAGE_WARNING:
fprintf(stderr, "%s DEBUG %s", sinfo, msg);
break;
case CAVAX_MESSAGE_DEBUG:
fprintf(stderr, "%s DEBUG %s", sinfo, msg);
break;
default:
fprintf(stderr, "%s LOG %s", sinfo, msg);
}
}