keymapping
This commit is contained in:
12
src/log.c
12
src/log.c
@@ -2,16 +2,16 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
void log_error(char* file, size_t line, char* str) {
|
||||
fprintf(stderr, "[ERROR] %s:%zu: %s\n", file, line, str);
|
||||
void log_with_tag(FILE* out_file, char* file_name, size_t line, const char* tag, char* str) {
|
||||
fprintf(out_file, "[%s] %s:%zu: %s\n", tag, file_name, line, str);
|
||||
}
|
||||
|
||||
void log_errorf(char* file, size_t line, char* fmt, ...) {
|
||||
fprintf(stderr, "[ERROR] %s:%zu: ", file, line);
|
||||
void logf_with_tag(FILE* out_file, char* file_name, size_t line, const char* tag, char* fmt, ...) {
|
||||
fprintf(out_file, "[%s] %s:%zu: ", tag, file_name, line);
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
vfprintf(out_file, fmt, args);
|
||||
va_end(args);
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(out_file, "\n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user