Nemerle.VisualStudio.Project.NemerleProjectNode.SetOutputLogger C# (CSharp) Method

SetOutputLogger() protected method

protected SetOutputLogger ( IVsOutputWindowPane output ) : void
output IVsOutputWindowPane
return void
        protected override void SetOutputLogger(IVsOutputWindowPane output)
        {
            //base.SetOutputLogger(output);
            // Create our logger, if it was not specified
            if (BuildLogger == null)
            {
                // Because we may be aggregated, we need to make sure to get the outer IVsHierarchy
                IntPtr unknown = IntPtr.Zero;
                IVsHierarchy hierarchy = null;
                try
                {
                    unknown = Marshal.GetIUnknownForObject(this);
                    hierarchy = Marshal.GetTypedObjectForIUnknown(unknown, typeof(IVsHierarchy)) as IVsHierarchy;
                }
                finally
                {
                    if (unknown != IntPtr.Zero)
                        Marshal.Release(unknown);
                }
                // Create the logger
                BuildLogger = new NemerleIdeBuildLogger(output, this.TaskProvider, hierarchy);

                // To retrive the verbosity level, the build logger depends on the registry root
                // (otherwise it will used an hardcoded default)
                ILocalRegistry2 registry = this.GetService(typeof(SLocalRegistry)) as ILocalRegistry2;
                if (null != registry)
                {
                    string registryRoot;
                    registry.GetLocalRegistryRoot(out registryRoot);
                    IDEBuildLogger logger = this.BuildLogger as IDEBuildLogger;
                    if (!String.IsNullOrEmpty(registryRoot) && (null != logger))
                    {
                        logger.BuildVerbosityRegistryRoot = registryRoot;
                        logger.ErrorString = this.ErrorString;
                        logger.WarningString = this.WarningString;
                    }
                }
            }
            else
            {
                ((NemerleIdeBuildLogger)this.BuildLogger).OutputWindowPane = output;
            }

            if (BuildEngine != null)
            {
                BuildEngine.UnregisterAllLoggers();
                BuildEngine.RegisterLogger(BuildLogger);
            }
        }