public LogEntry(object message, object args, SendingLogger logger = SendingLogger.CONSOLE, ConsoleColor?color = null) { this.target = null; this.thread = Thread.CurrentThread; this.time = DateTime.Now; this.message = message; this.args = args; this.channel = null; this.logger = logger; this.color = color; }
static void Send(LogTarget target, OutputEntry output) { if (target == null) { lock (logTargets) foreach (var tar in logTargets) { tar.Send(output); } } else { target.Send(output); } }
public static void OpenLogFile(string path) { var newpath = path; if (LogRotation) { var absolute = Path.GetFullPath(path); var dir = Path.GetDirectoryName(absolute); var name = Path.GetFileNameWithoutExtension(path); var ext = Path.GetExtension(path); newpath = Path.Combine(dir, String.Format("{0}_{1:yyyyMMdd_HHmm}{2}", name, DateTime.Now, ext)); } logFile = new FileOutputTarget(newpath); lock (logTargets) logTargets.Add(logFile); Log("Logging started to file \"{0}\".", newpath); }
public static void AddTarget(LogTarget target) { lock (logTargets) logTargets.Add(target); }
public static void RemoveTarget(LogTarget target) { lock (logTargets) logTargets.Remove(target); }
public static void AddTarget(LogTarget target) { lock (logTargets) logTargets.Add(target); }
public LogEntry(object message, object args, SendingLogger logger = SendingLogger.CONSOLE, ConsoleColor? color = null) { this.target = null; this.thread = Thread.CurrentThread; this.time = DateTime.Now; this.message = message; this.args = args; this.channel = null; this.logger = logger; this.color = color; }
static void Send(LogTarget target, OutputEntry output) { if (target == null) { lock (logTargets) foreach (var tar in logTargets) { tar.Send(output); } } else target.Send(output); }
public static void RemoveTarget(LogTarget target) { lock (logTargets) logTargets.Remove(target); }
public static void OpenLogFile(string path) { var newpath = path; if (LogRotation) { var absolute = Path.GetFullPath (path); var dir = Path.GetDirectoryName (absolute); var name = Path.GetFileNameWithoutExtension (path); var ext = Path.GetExtension (path); newpath = Path.Combine (dir, String.Format ("{0}_{1:yyyyMMdd_HHmm}{2}", name, DateTime.Now, ext)); } logFile = new FileOutputTarget(newpath); lock (logTargets) logTargets.Add(logFile); Log("Logging started to file \"{0}\".", newpath); }