r106364 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106363‎ | r106364 | r106365 >
Date:20:21, 15 December 2011
Author:petrb
Status:ok (Comments)
Tags:
Comment:
improved logs
Modified paths:
  • /trunk/tools/wmib/Core.cs (modified) (history)

Diff [purge]

Index: trunk/tools/wmib/Core.cs
@@ -768,6 +768,15 @@
769769 return null;
770770 }
771771
 772+ public static string timedateToString(int number)
 773+ {
 774+ if (number <= 9 && number >= 0)
 775+ {
 776+ return "0"+number.ToString();
 777+ }
 778+ return number.ToString();
 779+ }
 780+
772781 /// <summary>
773782 /// Send a message to channel
774783 /// </summary>
@@ -874,11 +883,11 @@
875884 string log;
876885 if (!noac)
877886 {
878 - log = "[" + System.DateTime.Now.Hour + ":" + System.DateTime.Now.Minute + ":" + System.DateTime.Now.Second + "] * " + user + " " + message + "\n";
 887+ log = "[" + timedateToString(System.DateTime.Now.Hour) + ":" + timedateToString(System.DateTime.Now.Minute) + ":" + timedateToString( System.DateTime.Now.Second) + "] * " + user + " " + message + "\n";
879888 }
880889 else
881890 {
882 - log = "[" + System.DateTime.Now.Hour + ":" + System.DateTime.Now.Minute + ":" + System.DateTime.Now.Second + "] " + "<" + user + "> " + message + "\n";
 891+ log = "[" + timedateToString( System.DateTime.Now.Hour) + ":" + timedateToString( System.DateTime.Now.Minute ) + ":" + timedateToString( System.DateTime.Now.Second) + "] " + "<" + user + ">\t " + message + "\n";
883892 }
884893 System.IO.File.AppendAllText(channel.log + System.DateTime.Now.Year + System.DateTime.Now.Month + System.DateTime.Now.Day +".txt", log);
885894 }

Comments

#Comment by Nikerabbit (talk | contribs)   10:36, 16 December 2011

Is there no str_pad in C#?

Status & tagging log