public LogEntry(object message, object args)
 {
     this.target  = null;
     this.thread  = Thread.CurrentThread;
     this.time    = DateTime.Now;
     this.message = message;
     this.args    = args;
     this.channel = null;
 }
Exemplo n.º 2
0
 public LogEntry(object message, object args, SendingLogger logger = SendingLogger.CONSOLE)
 {
     this.target  = null;
     this.thread  = Thread.CurrentThread;
     this.time    = DateTime.Now;
     this.message = message;
     this.args    = args;
     this.channel = null;
     this.logger  = logger;
 }
 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 (Program.properties.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 LogEntry(object message, object args)
 {
     this.target = null;
     this.thread = Thread.CurrentThread;
     this.time = DateTime.Now;
     this.message = message;
     this.args = args;
     this.channel = null;
 }
 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 (Program.properties.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 LogEntry(object message, object args, SendingLogger logger = SendingLogger.CONSOLE)
 {
     this.target = null;
     this.thread = Thread.CurrentThread;
     this.time = DateTime.Now;
     this.message = message;
     this.args = args;
     this.channel = null;
     this.logger = logger;
 }
 public static void RemoveTarget(LogTarget target)
 {
     lock (logTargets) logTargets.Remove(target);
 }
 public static void AddTarget(LogTarget target)
 {
     lock (logTargets) logTargets.Add(target);
 }