diff options
Diffstat (limited to 'utils/log.c')
-rw-r--r-- | utils/log.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/utils/log.c b/utils/log.c index e267b3179..97e1ee19a 100644 --- a/utils/log.c +++ b/utils/log.c @@ -301,5 +301,43 @@ nslog_finalise() } #ifdef WITH_NSLOG nslog_cleanup(); + + gettimeofday(&now_tv, NULL); + + timeval_subtract(&tv, &now_tv, &start_tv); + + snprintf(buff, sizeof(buff),"(%ld.%06ld)", + (long)tv.tv_sec, (long)tv.tv_usec); + + return buff; +} + +void nslog_log(const char *file, const char *func, int ln, const char *format, ...) +{ +#ifndef _TARGET_IS_KOLIBRIOS + va_list ap; + + fprintf(logfile, "%s %s:%i %s: ", nslog_gettime(), file, ln, func); + + va_start(ap, format); + + vfprintf(logfile, format, ap); + + va_end(ap); + + fputc('\n', logfile); +#else + va_list ap; + char message[1000]; + + va_start(ap, format); + vsprintf(message, format, ap); + va_end(ap); + + debug_board_printf(message); + debug_board_printf("\n"); +#endif +} + #endif } |