]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Serial log datestamp option.
authorToni Wilen <twilen@winuae.net>
Sat, 14 Jul 2018 18:24:44 +0000 (21:24 +0300)
committerToni Wilen <twilen@winuae.net>
Sat, 14 Jul 2018 18:24:44 +0000 (21:24 +0300)
include/sysdeps.h
od-win32/serial_win32.cpp
od-win32/win32.cpp
od-win32/writelog.cpp

index 8a6e65376b28de379ebcbc05289f9adf4537f0c1..756f2637102ed9fdd7f631b54c27d1cf32c63884 100644 (file)
@@ -469,6 +469,7 @@ extern int gui_message_multibutton (int flags, const TCHAR *format,...);
 extern void logging_init (void);
 extern FILE *log_open (const TCHAR *name, int append, int bootlog, TCHAR*);
 extern void log_close (FILE *f);
+extern TCHAR *write_log_get_ts(void);
 
 extern bool use_long_double;
 
index 1e581dda862afac6f61cd2cf3a58a244cd781270..20822e9903e1cf803117f2b6720805df5f426696 100644 (file)
@@ -178,6 +178,7 @@ static int serdatr_last_got;
 int serdev;
 int seriallog = 0, log_sercon = 0;
 int serial_enet;
+static bool seriallog_lf;
 extern int consoleopen;
 
 void serial_open (void);
@@ -227,7 +228,8 @@ void SERPER (uae_u16 w)
 #endif
        if (log_sercon) {
                serial_period_hsyncs = 1;
-               seriallog = 1;
+               seriallog = log_sercon;
+               seriallog_lf = true;
                write_logx(_T("\n"));
        }
 
@@ -481,7 +483,16 @@ static void serdatcopy(void)
 
        if (seriallog > 0 || (consoleopen && seriallog < 0)) {
                gotlogwrite = true;
-               write_logx(_T("%c"), docharlog(serdatshift_masked));
+               if (seriallog_lf && seriallog > 1) {
+                       TCHAR *ts = write_log_get_ts();
+                       if (ts)
+                               write_logx(_T("%s:"), ts);
+                       seriallog_lf = false;
+               }
+               TCHAR ch = docharlog(serdatshift_masked);
+               write_logx(_T("%c"), ch);
+               if (ch == 10)
+                       seriallog_lf = true;
        }
 
        if (serper == 372) {
index 79b302a5da326d4327e1abeedb0dab807d8decac..50b3cb993b20bd1b036e5bda3b91f2f082fa4663 100644 (file)
@@ -6176,6 +6176,10 @@ static int parseargs(const TCHAR *argx, const TCHAR *np, const TCHAR *np2)
                log_sercon = 1;
                return 1;
        }
+       if (!_tcscmp(arg, _T("serlog2"))) {
+               log_sercon = 2;
+               return 1;
+       }
        if (!_tcscmp(arg, _T("a2065log"))) {
                log_a2065 = 1;
                return 1;
index 4cb003d60d6d4f2c7cf72d22f9307b33a4544c6b..64a82c73ba828aac47052c564ef8c7f53d8b3f65 100644 (file)
@@ -482,7 +482,7 @@ void console_flush (void)
 
 static int lfdetected = 1;
 
-static TCHAR *writets (void)
+TCHAR *write_log_get_ts(void)
 {
        struct tm *t;
        struct _timeb tb;
@@ -657,7 +657,7 @@ void write_log (const TCHAR *format, ...)
        bufp[bufsize - 1] = 0;
        if (!_tcsncmp (bufp, _T("write "), 6))
                bufsize--;
-       ts = writets ();
+       ts = write_log_get_ts();
        if (bufp[0] == '*')
                count++;
        if (SHOW_CONSOLE || console_logging) {