Beispiel #1
0
        protected virtual void OnWroteLine(string args)
        {
            WriteLineEvent handler = Wrote;

            if (handler != null)
            {
                handler(this, args);
            }
        }
 public override void WriteLine(string value)
 {
     WriteLineEvent?.Invoke(this, new ConsoleWriterEventArgs(value));
     base.WriteLine(value);
     if (sw != null)
     {
         sw.WriteLine($"{DateTime.Now} {value}");
     }
 }
Beispiel #3
0
        private void WriteLine(string msg)
        {
            if (!_disposed)
            {
                lock (_logLock)
                {
                    var log = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} {msg}";
                    _streamWriter?.WriteLine(log);

                    if (ConsoleLogging)
                    {
                        Console.WriteLine(msg.Substring(msg.IndexOf(']') + 2));
                    }

                    WriteLineEvent?.Invoke(this, log);
                }
            }
            else
            {
                throw new Exception("Cannot write to a disposed logger instance");
            }
        }
Beispiel #4
0
 public override void WriteLine(string value)
 {
     WriteLineEvent?.Invoke(this, new ConsoleWriterEventArgs(value));
 }
 public override void WriteLine(string value)
 {
     value += "\n";
     WriteLineEvent?.Invoke(this, new ConsoleWriterEventArgs(value));
     base.WriteLine();
 }
 public static void WriteLine()
 {
     WriteLineEvent?.Invoke("", null);
 }
 public static void WriteLine(string format, params object[] arg)
 {
     WriteLineEvent?.Invoke(format, arg);
 }
 public static void WriteLine(string format)
 {
     WriteLineEvent?.Invoke("{0}", format);
 }
Beispiel #9
0
 /// <summary>Writes the specified string value, followed by the current line terminator, to the standard output console.</summary>
 /// <param name="value">The value to write.</param>
 public static void WriteLine(string value) => WriteLineEvent?.Invoke("{0}", value);
Beispiel #10
0
 public override void WriteLine(string value)
 {
     WriteLineEvent?.Invoke(this, value);
     base.WriteLine(value);
 }