Пример #1
0
        public void WriteLine(LogEntry entry)
        {
            Color logColor;
            switch (entry.Type)
            {
                case LogType.Error:
                    logColor = Color.Red;
                    break;
                case LogType.Warning:
                    logColor = Color.OrangeRed;
                    break;
                case LogType.Information:
                    logColor = Color.SteelBlue;
                    break;
                case LogType.Good:
                    logColor = Color.ForestGreen;
                    break;
                case LogType.Normal:
                default:
                    logColor = Color.Black;
                    break;
            }

            rbLogBox.Invoke((Action)(() =>
            {
                rbLogBox.SelectionColor = logColor;
                rbLogBox.AppendText(entry.FormattedMessage + Environment.NewLine);
                rbLogBox.ScrollToCaret();
            }));
        }
Пример #2
0
        public static void WriteLine(LogType type, string text, params object[] args)
        {
            var entry = new LogEntry(type, DateTime.Now, string.Format(text, args));
            LogContent.AddLast(entry);

            foreach (ILog LogReader in LogReaders)
                LogReader.WriteLine(entry);
        }
Пример #3
0
 public void WriteLine(LogEntry entry)
 {
     sw.WriteLine("[" + entry.Type.ToString().ToUpper() + "] " + entry.FormattedMessage);
 }