IsConsoleAvailable() public static method

public static IsConsoleAvailable ( string &reason ) : bool
reason string
return bool
        /// <summary>
        /// Initializes the target.
        /// </summary>
        protected override void InitializeTarget()
        {
            this.pauseLogging = false;
            if (DetectConsoleAvailable)
            {
                string reason;
                pauseLogging = !ConsoleTargetHelper.IsConsoleAvailable(out reason);
                if (pauseLogging)
                {
                    InternalLogger.Info("Console has been detected as turned off. Disable DetectConsoleAvailable to skip detection. Reason: {0}", reason);
                }
            }
#if !SILVERLIGHT && !__IOS__ && !__ANDROID__
            if (this.encoding != null && !this.pauseLogging)
            {
                Console.OutputEncoding = this.encoding;
            }
#endif
            base.InitializeTarget();
            if (this.Header != null)
            {
                LogEventInfo lei = LogEventInfo.CreateNullEvent();
                this.WriteToOutput(lei, base.RenderLogEvent(this.Header, lei));
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Initializes the target.
 /// </summary>
 protected override void InitializeTarget()
 {
     PauseLogging = false;
     if (DetectConsoleAvailable)
     {
         string reason;
         PauseLogging = !ConsoleTargetHelper.IsConsoleAvailable(out reason);
         if (PauseLogging)
         {
             InternalLogger.Info("Console has been detected as turned off. Disable DetectConsoleAvailable to skip detection. Reason: {0}", reason);
         }
     }
     base.InitializeTarget();
     if (Header != null)
     {
         this.WriteToOutput(Header.Render(LogEventInfo.CreateNullEvent()));
     }
 }