Make logger buffer bigger
This commit is contained in:
parent
5d3c94ef8c
commit
943dd8e0d1
1 changed files with 7 additions and 1 deletions
|
@ -65,7 +65,13 @@ logger_log(int level, const char *filename, int line, const char *func, const ch
|
||||||
strftime(timestamp_str, 32, "%Y-%m-%d %H:%M:%S", localtime(&rawtime));
|
strftime(timestamp_str, 32, "%Y-%m-%d %H:%M:%S", localtime(&rawtime));
|
||||||
size_t timestamp_len = strlen(timestamp_str);
|
size_t timestamp_len = strlen(timestamp_str);
|
||||||
|
|
||||||
char *buffer = malloc(sizeof(char) * (128 + strlen(msg) + timestamp_len));
|
size_t buffer_size = 128;
|
||||||
|
buffer_size += timestamp_len;
|
||||||
|
buffer_size += strlen(filename);
|
||||||
|
buffer_size += strlen(func);
|
||||||
|
buffer_size += strlen(msg);
|
||||||
|
|
||||||
|
char *buffer = malloc(sizeof(char) * (buffer_size);
|
||||||
sprintf(buffer, "%s %s[%5s] %s:%d:%s " COLOR_NONE "%s", timestamp_str, color, level_str, filename, line, func, msg);
|
sprintf(buffer, "%s %s[%5s] %s:%d:%s " COLOR_NONE "%s", timestamp_str, color, level_str, filename, line, func, msg);
|
||||||
|
|
||||||
// start arg va_list and find log_len
|
// start arg va_list and find log_len
|
||||||
|
|
Loading…
Reference in a new issue