Beispiel #1
0
        public static void WriteLine(string line)
        {
            try
            {
                line = $"{ DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") } | { line }";

                lock (logLock)
                {
                    File.AppendAllLines(LogFile, new string[] { line });
                }

                if (WriteToConsole)
                {
                    Console.WriteLine(line);
                }

                if (Debugger.IsAttached)
                {
                    Debug.WriteLine(line);
                }

                LogLineAdded?.Invoke(line);
            }
            catch (Exception ex)
            {
                ShowNotification?.Invoke(ex.ToString());
            }
        }
Beispiel #2
0
        protected void AddLogLine(string text)
        {
            lock (LogLines)
                LogLines.Add(text);

            LogLineAdded?.Invoke(this, EventArgs.Empty);
        }
Beispiel #3
0
        public override void AddLogLine(LogLine line)
        {
            mLog.Enqueue(line);

            LogLineAdded?.Invoke(this, new EventArgs());
        }