22using System ;
33using System . Collections . Generic ;
44using System . Diagnostics ;
5+ using System . Globalization ;
56using System . IO ;
67using System . Linq ;
78using System . Net ;
@@ -32,6 +33,7 @@ public static class Logger {
3233
3334 static readonly string SessionStart = DateTime . Now . ToString ( LongDateFormat ) ; // localized
3435 static readonly Queue < string > RecentMessages = new Queue < string > ( ) ;
36+ static DateTimeFormatInfo formatter = CultureInfo . InvariantCulture . DateTimeFormat ;
3537 const int MaxRecentMessages = 25 ;
3638
3739 /// <summary> Name of the file that log messages are currently being written to.
@@ -42,7 +44,7 @@ public static string CurrentLogFileName {
4244 case LogSplittingType . SplitBySession :
4345 return SessionStart + ".log" ;
4446 case LogSplittingType . SplitByDay :
45- return DateTime . Now . ToString ( ShortDateFormat ) + ".log" ; // localized
47+ return DateTime . Now . ToString ( ShortDateFormat , formatter ) + ".log" ; // localized
4648 default :
4749 return DefaultLogFileName ;
4850 }
@@ -116,7 +118,7 @@ public static void Log( LogType type, [NotNull] string message, [NotNull] params
116118 if ( ! Enabled ) return ;
117119
118120 message = Color . StripColors ( message , true ) ;
119- string line = DateTime . Now . ToString ( TimeFormat ) + " > " + GetPrefix ( type ) + message ; // localized
121+ string line = DateTime . Now . ToString ( TimeFormat , formatter ) + " > " + GetPrefix ( type ) + message ; // localized
120122
121123 lock ( LogLock ) {
122124 RaiseLoggedEvent ( message , line , type ) ;
@@ -133,7 +135,7 @@ public static void Log( LogType type, [NotNull] string message, [NotNull] params
133135 } catch ( Exception ex ) {
134136 string errorMessage = "Logger.Log: " + ex ;
135137 line = String . Format ( "{0} > {1}{2}" ,
136- DateTime . Now . ToString ( TimeFormat ) , // localized
138+ DateTime . Now . ToString ( TimeFormat , formatter ) , // localized
137139 GetPrefix ( LogType . Error ) ,
138140 errorMessage ) ;
139141 RaiseLoggedEvent ( errorMessage ,
0 commit comments