18 lines
518 B
C
18 lines
518 B
C
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <stdarg.h>
|
|
|
|
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 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(out_file, fmt, args);
|
|
va_end(args);
|
|
fprintf(out_file, "\n");
|
|
}
|
|
|