NLog.Targets.ColoredConsoleTarget.InitializeTarget C# (CSharp) Method

InitializeTarget() protected method

Initializes the target.
protected InitializeTarget ( ) : void
return void
        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 (Header != null)
            {
                LogEventInfo lei = LogEventInfo.CreateNullEvent();
                this.WriteToOutput(lei, Header.Render(lei));
            }
        }