めも

#include  
#include  

void Logger_debug(const char* fmt, ...) {
    FILE* fp = fopen(LOG_PATHNAME, "at");
    if (fp != NULL) {
        time_t t = time(NULL);
        struct tm* tm;
        tm = localtime(&t);
        fprintf(fp, "%04d/%02d/%02d %02d:%02d:%02d ",
            1900 + tm->tm_year,
            tm->tm_mon + 1,
            tm->tm_mday,
            tm->tm_hour,
            tm->tm_min,
            tm->tm_sec);
        va_list argptr;
        va_start(argptr, fmt);
        vfprintf(fp, fmt, argptr);
        fprintf(fp,"\n");
        va_end(argptr);
        fclose(fp);
    }
}