psx emulator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
817 B

  1. #include "log.h"
  2. #include <stdarg.h>
  3. #include <stdio.h>
  4. #include <time.h>
  5. const char *REG_NAMES[32] = {
  6. "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7", "R8", "R9", "R10",
  7. "R11", "R12", "R13", "R14", "R15", "R16", "R17", "R18", "R19", "R20", "R21",
  8. "R22", "R23", "R24", "R25", "R26", "R27", "GP", "SP", "FP", "RA"};
  9. void _log(const char *filename, const char *funcname, int line_num,
  10. const char *level, const char *fmt, ...) {
  11. time_t now;
  12. char fmt_time[sizeof "2011-10-08T07:07:09Z"];
  13. time(&now);
  14. strftime(&fmt_time[0], sizeof fmt_time, "%Y-%m-%dT%H:%M:%S", gmtime(&now));
  15. printf("%s,%s,%s,%d,%s,\"", fmt_time, level, filename, line_num, funcname);
  16. va_list args;
  17. va_start(args, fmt);
  18. vprintf(fmt, args);
  19. va_end(args);
  20. printf("\"\n");
  21. }