An alternative to UBB.threads
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
FLocal/Patcher/Logger.cs

40 lines
843 B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Web.Core;
namespace Patcher {
class Logger : ILogger {
public static string LogDir {
set {
lock(_instance.locker) {
_instance.writer = new StreamWriter(Path.Combine(value, DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".patcher.txt"));
}
}
}
private static readonly Logger _instance = new Logger();
public static readonly ILogger instance = _instance;
private StreamWriter writer;
private readonly object locker = new object();
private Logger() {
}
void ILogger.Log(string message) {
lock(this.locker) {
this.writer.WriteLine(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff") + ": " + message);
this.writer.Flush();
}
}
}
}