Changeset 253 in Main for trunk/Common


Ignore:
Timestamp:
Oct 4, 2024, 12:13:36 PM (6 weeks ago)
Author:
Nishi
Message:

fix stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Common/log.c

    r212 r253  
    33#include "cm_log.h"
    44
     5#include "../config.h"
    56#include "cm_string.h"
    67
     
    2627#define LOGNAME_LENGTH 12
    2728
     29#ifdef BUILD_GUI_VALID
     30void AddLog(const char* str);
     31#endif
     32
    2833void cm_force_log(const char* log) {
    2934        time_t t = time(NULL);
    3035        struct tm* tm = localtime(&t);
    3136        char date[513];
     37        char* str;
    3238        strftime(date, 512, "%a %b %d %H:%M:%S %Z %Y", tm);
    3339#ifdef _PSP
     
    3541#elif defined(__PPU__)
    3642        tt_printf("[%s] %s\n", date, log);
     43#elif defined(BUILD_GUI_VALID)
     44        str = malloc(strlen(date) + strlen(log) + 3 + 1);
     45        str[strlen(date) + strlen(log) + 3] = 0;
     46        sprintf(str, "[%s] %s", date, log);
     47        AddLog(str);
     48        free(str);
    3749#else
    3850        fprintf(logfile, "[%s] %s\n", date, log);
     51        fflush(logfile);
    3952#endif
    40         fflush(logfile);
    4153}
    4254
Note: See TracChangeset for help on using the changeset viewer.