From e94504c0d57e0cc3f6508c489762d7ffea3242be Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Fri, 21 Apr 2017 23:18:15 +0200 Subject: Move port for kolibrios ahead. Look at diff from master and reconcile. --- utils/log.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'utils/log.c') 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 } -- cgit v1.2.3