Fix logging when timestamps are disabled after recent changes

The changes of 1065e61ab7 (Merge branch 'log-ms', 2021-01-16) broke
logging when timestamps were disabled as they still tried to format the
timestamp in this case, using empty timestamp, which resulted in an
assert.

Fix this and also make new code more similar to the existing one by
adding wxLog::TimeStampMS() helper parallel to the already existing
TimeStamp() and write it in the same way -- which notably ensures that
it does nothing when the timestamp is empty.

See #13059.
This commit is contained in:
Vadim Zeitlin
2021-01-17 17:44:51 +01:00
parent 4eb345f8fe
commit cc28cd6816
2 changed files with 15 additions and 4 deletions

View File

@@ -533,6 +533,7 @@ public:
// change it otherwise); the first overload uses the current time.
static void TimeStamp(wxString *str);
static void TimeStamp(wxString *str, time_t t);
static void TimeStampMS(wxString *str, wxLongLong_t msec);
// these methods should only be called from derived classes DoLogRecord(),
// DoLogTextAtLevel() and DoLogText() implementations respectively and