HttpServer.ConsoleLogWriter.Write C# (CSharp) Method

Write() public method

Logwriters the specified source.
public Write ( object source, LogPrio prio, string message ) : void
source object object that wrote the logentry.
prio LogPrio Importance of the log message
message string The message.
return void
        public void Write(object source, LogPrio prio, string message)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(DateTime.Now.ToString());
            sb.Append(" ");
            sb.Append(prio.ToString().PadRight(10));
            sb.Append(" | ");
            #if DEBUG
            StackTrace trace = new StackTrace();
            StackFrame[] frames = trace.GetFrames();
            int endFrame = frames.Length > 4 ? 4 : frames.Length;
            int startFrame = frames.Length > 0 ? 1 : 0;
            for (int i = startFrame; i < endFrame; ++i)
            {
                sb.Append(frames[i].GetMethod().Name);
                sb.Append(" -> ");
            }
            #else
            sb.Append(System.Reflection.MethodBase.GetCurrentMethod().Name);
            sb.Append(" | ");
            #endif
            sb.Append(message);

            Console.ForegroundColor = GetColor(prio);
            Console.WriteLine(sb.ToString());
            Console.ForegroundColor = ConsoleColor.Gray;
        }
ConsoleLogWriter