Пример #1
0
        public virtual void EnqueueMessage(LogMessageEntry message)
        {
            if (!_messageQueue.IsAddingCompleted)
            {
                try
                {
                    _messageQueue.Add(message);
                    return;
                }
                catch (InvalidOperationException) { }
            }

            // Adding is completed so just log the message
            WriteMessage(message);
        }
        // for testing
        internal virtual void WriteMessage(LogMessageEntry message)
        {
            IConsole console = message.LogAsError ? ErrorConsole : Console;

            if (message.TimeStamp != null)
            {
                console.Write(message.TimeStamp, message.MessageColor, message.MessageColor);
            }

            if (message.LevelString != null)
            {
                console.Write(message.LevelString, message.LevelBackground, message.LevelForeground);
            }

            console.Write(message.Message, message.MessageColor, message.MessageColor);
            console.Flush();
        }
Пример #3
0
        // for testing
        internal virtual void WriteMessage(LogMessageEntry entry)
        {
            IConsole console = entry.LogAsError ? ErrorConsole : Console;

            console.Write(entry.Message);
        }