Exemplo n.º 1
0
        protected override void Append(LoggingEvent le)
        {
            if (m_console != null)
            {
                m_console.LockOutput();
            }

            string loggingMessage = RenderLoggingEvent(le);

            try
            {
                if (m_console != null)
                {
                    m_console.Output(loggingMessage, le.Level.Name);
                }
                else
                {
                    if (!loggingMessage.EndsWith("\n"))
                    {
                        System.Console.WriteLine(loggingMessage);
                    }
                    else
                    {
                        System.Console.Write(loggingMessage);
                    }
                }
            }
            catch (Exception e)
            {
                System.Console.WriteLine("Couldn't write out log message: {0}", e);
            }
            finally
            {
                if (m_console != null)
                {
                    m_console.UnlockOutput();
                }
            }
        }