Output() public method

public Output ( string text ) : void
text string
return void
示例#1
0
        override protected void Append(LoggingEvent le)
        {
            if (m_console != null)
            {
                m_console.LockOutput();
            }

            string loggingMessage = RenderLoggingEvent(le);

            try
            {
                if (m_console != null)
                {
                    ConsoleLevel level;

                    if (le.Level == Level.Error)
                    {
                        level = "error";
                    }
                    else if (le.Level == Level.Warn)
                    {
                        level = "warn";
                    }
                    else
                    {
                        level = "normal";
                    }

                    m_console.Output(loggingMessage, level);
                }
                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.ToString());
            }
            finally
            {
                if (m_console != null)
                {
                    m_console.UnlockOutput();
                }
            }
        }
 /// <summary>
 /// Shows help information on the console's Notice method
 /// </summary>
 public void ShowHelp(ConsoleBase console)
 {
     console.Output(String.Join(" ", m_cmdText) + " - " + m_helpText + "\n");
 }
 /// <summary>
 /// Shows help information on the console's Notice method
 /// </summary>
 public void ShowHelp(ConsoleBase console)
 {
     console.Output(String.Join(" ", m_cmdText) + " - " + m_helpText);
 }