Example #1
0
 /// <summary>
 /// Writes a formatted line to the console.
 /// </summary>
 /// <param name="Source">Message source</param>
 /// <param name="Verbosity">Message verbosity</param>
 /// <param name="Format">Message format string</param>
 /// <param name="Args">Format arguments</param>
 private void WriteLine(string Source, TraceEventType Verbosity, string Format, params object[] Args)
 {
     lock (SyncObject)
     {
         string Message = LogUtils.FormatMessage(Source, Verbosity, Format, Args);
         if (Filter == null || Filter.ShouldTrace(null, Source, Verbosity, 0, Format, Args, null, null))
         {
             AccumulatedLog.AppendLine(Message);
         }
     }
 }
Example #2
0
        /// <summary>
        /// Writes a formatted line to the console.
        /// </summary>
        /// <param name="Source">Message source</param>
        /// <param name="Verbosity">Message verbosity</param>
        /// <param name="Format">Message format string</param>
        /// <param name="Args">Format arguments</param>
        private void WriteLine(string Source, TraceEventType Verbosity, string Format, params object[] Args)
        {
            string Message = LogUtils.FormatMessage(Source, Verbosity, Format, Args);

            if (Filter == null || Filter.ShouldTrace(null, Source, Verbosity, 0, Format, Args, null, null))
            {
                ConsoleColor DefaultColor = Console.ForegroundColor;
                switch (Verbosity)
                {
                case TraceEventType.Critical:
                case TraceEventType.Error:
                    Console.ForegroundColor = ConsoleColor.Red;
                    break;

                case TraceEventType.Warning:
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    break;
                }
                Console.WriteLine(Message);
                Console.ForegroundColor = DefaultColor;
            }
        }
Example #3
0
 public void WriteLine(string Source, TraceEventType Verbosity, string Message)
 {
     Message = LogUtils.FormatMessage(Source, Verbosity, Message);
     WriteToFile(Message);
 }
Example #4
0
        public void WriteLine(string Source, TraceEventType Verbosity, string Format, params object[] Args)
        {
            var Message = LogUtils.FormatMessage(Source, Verbosity, Format, Args);

            WriteToFile(Message);
        }