#include #include #include #include void error(char *fmt, ...) { va_list args; va_start(args, fmt); time_t now = time(NULL); struct tm tm = *localtime(&now); fprintf(stderr, "[%02d/%02d/%d %02d:%02d:%02d] -ERROR- ", tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900, tm.tm_hour, tm.tm_hour, tm.tm_sec); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); va_end(args); } void info(char *fmt, ...) { va_list args; va_start(args, fmt); time_t now = time(NULL); struct tm tm = *localtime(&now); fprintf(stdout, "[%02d/%02d/%d %02d:%02d:%02d] -INFO- ", tm.tm_mday, tm.tm_mon + 1, tm.tm_year + 1900, tm.tm_hour, tm.tm_hour, tm.tm_sec); vfprintf(stdout, fmt, args); fprintf(stdout, "\n"); va_end(args); }