diff --git a/Utils/FileLogger.cs b/Utils/FileLogger.cs index 6157d7d..a49364c 100644 --- a/Utils/FileLogger.cs +++ b/Utils/FileLogger.cs @@ -4,44 +4,38 @@ using System.Linq; using System.Text; using System.IO; -namespace BlubbFish.Utils -{ - public class FileLogger - { - private static Dictionary instances = new Dictionary(); - private StreamWriter file; - private FileLogger(string filename, bool append) - { - if (!File.Exists(filename)) - { - string folder = Path.GetDirectoryName(Path.GetFullPath(filename)); - if (!Directory.Exists(folder)) - { - Directory.CreateDirectory(folder); - } - } - this.file = new StreamWriter(filename, append, Encoding.UTF8); - this.file.AutoFlush = true; - } - public static FileLogger getInstance(string filename, bool append) - { - if (!instances.Keys.Contains(filename)) - { - instances.Add(filename, new FileLogger(filename, append)); - } - return instances[filename]; - } - - public void setArray(string[] text) - { - this.file.Write(String.Join(file.NewLine, text) + file.NewLine); - this.file.Flush(); - } - - public void setLine(string text) - { - this.file.WriteLine(text); - this.file.Flush(); +namespace BlubbFish.Utils { + public class FileLogger { + private static Dictionary instances = new Dictionary(); + private StreamWriter file; + private FileLogger(string filename, bool append) { + if(!File.Exists(filename)) { + string folder = Path.GetDirectoryName(Path.GetFullPath(filename)); + if(!Directory.Exists(folder)) { + Directory.CreateDirectory(folder); } + } + this.file = new StreamWriter(filename, append, Encoding.UTF8); + this.file.AutoFlush = true; } + public static FileLogger getInstance(string filename, bool append) { + if(!instances.Keys.Contains(filename)) { + instances.Add(filename, new FileLogger(filename, append)); + } + return instances[filename]; + } + + public void setArray(string[] text) { + this.file.Write(String.Join(file.NewLine, text) + file.NewLine); + this.file.Flush(); + } + + public void setLine(string text) { + this.file.WriteLine(text); + this.file.Flush(); + } + public void setLine(string text, DateTime d) { + this.setLine(d.ToString("[yyyy-MM-dd HH:mm:ss.ffff] " + text)); + } + } } diff --git a/Utils/bin/Release/Utils.dll b/Utils/bin/Release/Utils.dll index 914f560..0dd4d12 100644 Binary files a/Utils/bin/Release/Utils.dll and b/Utils/bin/Release/Utils.dll differ