summaryrefslogtreecommitdiff
path: root/utils/log.c
diff options
context:
space:
mode:
authorAshish Gupta <ashmew2@gmail.com>2017-04-21 23:18:15 +0200
committerAshish Gupta <ashmew2@gmail.com>2017-10-25 22:04:54 +0200
commite94504c0d57e0cc3f6508c489762d7ffea3242be (patch)
treed38488d1cd055d2ba3b81a75a1cf4ad317057777 /utils/log.c
parent476423b2ec5479efd3fbe5a83689dfad6622036a (diff)
downloadnetsurf-e94504c0d57e0cc3f6508c489762d7ffea3242be.tar.gz
netsurf-e94504c0d57e0cc3f6508c489762d7ffea3242be.tar.bz2
Move port for kolibrios ahead.
Look at diff from master and reconcile.
Diffstat (limited to 'utils/log.c')
-rw-r--r--utils/log.c38
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
}