Beispiel #1
0
        // for testing
        internal virtual void WriteMessage(LogMessageEntry message)
        {
            if (message.LevelString != null)
            {
                Console.Write(message.LevelString, message.LevelBackground, message.LevelForeground);
            }

            Console.Write(message.Message, message.MessageColor, message.MessageColor);
        }
Beispiel #2
0
        // for testing
        internal virtual void WriteMessage(LogMessageEntry message)
        {
            var dateTime = $"[{DateTimeOffset.Now.ToString("yy-MM-dd hh:mm:ss")}] ";

            Console.Write(dateTime, 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();
        }
Beispiel #3
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);
        }
Beispiel #4
0
        // for testing
        internal virtual void WriteMessage(LogMessageEntry message)
        {
            var dateTime = $"[{DateTimeOffset.Now.ToString("yy-MM-dd HH:mm:ss")}] ";

            Console.Write(dateTime, 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();

            try {
                // This is a hack, but it avoids having to rewrite the NTB logging subsystem completely
                WriteMessageToDisk($"{dateTime} {message.LevelString} {message.Message}");
            }
            catch (Exception) { }
        }