Esempio n. 1
0
        /// <summary>
        /// Writes an uncategorized message to the console, with the specified color formatting.
        /// </summary>
        /// <param name="obj">The object the message is originating from. Can be null.</param>
        /// <param name="colors">The ColorFormat to use when writing the message.</param>
        /// <param name="message">The message to write to the console.</param>
        /// <param name="args">Optional arguments to use when formatting the message.</param>
        public static void Write(object obj, Terminal.Formatting.ColorFormat colors, string message, params object[] args)
        {
            if (IsValid(obj))
            {
                var header = GetMessageHeader(obj, true, true);

                message = Formatters.GetColorFormattedString(colors, message, args);

                Write("{0}{1}", header, message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Writes a debug message to the console, with the specified color formatting.
        /// </summary>
        /// <param name="obj">The object the message is originating from. Can be null.</param>
        /// <param name="colors">The ColorFormat to use when writing the message.</param>
        /// <param name="message">The message to write to the console.</param>
        /// <param name="args">Optional arguments to use when formatting the message.</param>
        public static void WriteLine(object obj, Terminal.Formatting.ColorFormat colors, string message, params object[] args)
        {
            if (IsValid(obj))
            {
                message = Formatters.GetColorFormattedString(colors, message, args);

                if (isLastWriteALine)
                {
                    var headerColors = GetHeaderColors(obj);
                    var header       = Formatters.GetColorFormattedString(headerColors, GetMessageHeaderWithTimestamp(obj));
                    WriteLine("{0}{1}", header, message);
                }
                else
                {
                    WriteLine(message);
                }
            }
        }