Obsolete
/
libipc-old
Archived
3
0
Fork 0
This repository has been archived on 2024-06-18. You can view files and clone it, but cannot push or open issues/pull-requests.
libipc-old/core/logger.c

45 lines
810 B
C

#include "logger.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
void log_format (const char* tag, const char* message, va_list args) {
time_t now;
time(&now);
char * date =ctime(&now);
date[strlen(date) - 1] = '\0';
printf("%s:%s: ", date, tag);
vprintf(message, args);
printf("\n");
}
void log_error (const char* message, ...) {
va_list args;
va_start(args, message);
log_format("error", message, args);
va_end(args);
}
void log_info (const char* message, ...) {
va_list args;
va_start(args, message);
log_format("info", message, args);
va_end(args);
}
void log_debug (const char* message, ...) {
va_list args;
va_start(args, message);
log_format("debug", message, args);
va_end(args);
}