diff --git a/fCraft/System/Logger.cs b/fCraft/System/Logger.cs index 96da4d3..e2d5be1 100644 --- a/fCraft/System/Logger.cs +++ b/fCraft/System/Logger.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Globalization; using System.IO; using System.Linq; using System.Net; @@ -32,6 +33,7 @@ public static class Logger { static readonly string SessionStart = DateTime.Now.ToString( LongDateFormat ); // localized static readonly Queue RecentMessages = new Queue(); + static DateTimeFormatInfo formatter = CultureInfo.InvariantCulture.DateTimeFormat; const int MaxRecentMessages = 25; /// Name of the file that log messages are currently being written to. @@ -42,7 +44,7 @@ public static class Logger { case LogSplittingType.SplitBySession: return SessionStart + ".log"; case LogSplittingType.SplitByDay: - return DateTime.Now.ToString( ShortDateFormat ) + ".log"; // localized + return DateTime.Now.ToString( ShortDateFormat, formatter ) + ".log"; // localized default: return DefaultLogFileName; } @@ -116,7 +118,7 @@ public static class Logger { if( !Enabled ) return; message = Color.StripColors( message, true ); - string line = DateTime.Now.ToString( TimeFormat ) + " > " + GetPrefix( type ) + message; // localized + string line = DateTime.Now.ToString( TimeFormat, formatter ) + " > " + GetPrefix( type ) + message; // localized lock( LogLock ) { RaiseLoggedEvent( message, line, type ); @@ -133,7 +135,7 @@ public static class Logger { } catch( Exception ex ) { string errorMessage = "Logger.Log: " + ex; line = String.Format( "{0} > {1}{2}", - DateTime.Now.ToString( TimeFormat ),// localized + DateTime.Now.ToString( TimeFormat, formatter ),// localized GetPrefix( LogType.Error ), errorMessage ); RaiseLoggedEvent( errorMessage,