Example #1
0
        private void M(string messageText, LogLevel messageLogLevel)
        {
            var message = new LogMessage { Time = DateTime.Now, Level = messageLogLevel, Text = messageText };
            Log.Add(message);

            if (CurrentLogLevel.Level >= messageLogLevel.Level)
            {
                messages.BeginInvoke(new Action(() => messages.AppendText(message.Time.ToString("dd.MM.yyyy hh:mm:ss - ") +  messageText + "\r\n")));
            }
        }
Example #2
0
        private void SetLogLevel(LogLevel level)
        {
            for(var i = 0; i < logLevel.Items.Count; i++)
            {
                if (((LogLevel)logLevel.Items[i]).Level == level.Level)
                {
                    logLevel.SelectedIndex = i;

                    return;
                }
            }
        }
Example #3
0
        private void logLevel_SelectedIndexChanged(object sender, EventArgs e)
        {
            CurrentLogLevel = (LogLevel)logLevel.SelectedItem;

            messages.Clear();

            foreach (var message in Log.OrderBy(m => m.Time))
            {
                if (CurrentLogLevel.Level >= message.Level.Level)
                {
                    messages.AppendText(message.Time.ToString("dd.MM.yyyy hh:mm:ss - ") + message.Text + "\r\n");
                }
            }
        }