equal
deleted
inserted
replaced
1 #include "logging.h" |
1 #include "logging.h" |
2 |
2 |
3 #include <time.h> |
3 #include <time.h> |
4 #include <stdio.h> |
4 #include <stdio.h> |
5 #include <stdarg.h> |
5 #include <stdarg.h> |
|
6 #include <stdlib.h> |
6 |
7 |
7 char* flib_format_ip(uint32_t numip) { |
8 char* flib_format_ip(uint32_t numip) { |
8 static char ip[16]; |
9 static char ip[16]; |
9 snprintf(ip, 16, "%u.%u.%u.%u", numip>>24, (numip>>16)&0xff, (numip>>8)&0xff, numip&0xff); |
10 snprintf(ip, 16, "%u.%u.%u.%u", numip>>24, (numip>>16)&0xff, (numip>>8)&0xff, numip&0xff); |
10 return ip; |
11 return ip; |
25 static void flib_vflog(FILE *file, const char *prefix, const char *fmt, va_list args) { |
26 static void flib_vflog(FILE *file, const char *prefix, const char *fmt, va_list args) { |
26 log_time(file); |
27 log_time(file); |
27 fprintf(file, " [%s]", prefix); |
28 fprintf(file, " [%s]", prefix); |
28 vfprintf(file, fmt, args); |
29 vfprintf(file, fmt, args); |
29 fprintf(file, "\n"); |
30 fprintf(file, "\n"); |
|
31 fflush(file); |
30 } |
32 } |
31 |
33 |
32 void flib_log_e(const char *fmt, ...) { |
34 void flib_log_e(const char *fmt, ...) { |
33 va_list argp; |
35 va_list argp; |
34 va_start(argp, fmt); |
36 va_start(argp, fmt); |