示例#1
0
        private void RenderLoggerImplementation(Project project, ProjectItem <LoggerModel> loggerProjectItem)
        {
            var loggerModel = loggerProjectItem.Content;

            if (loggerModel == null)
            {
                LogError(
                    $"{loggerProjectItem.Name} should have a content of type {typeof(LoggerModel).Name} set but found {loggerProjectItem.Content?.GetType().Name ?? "null"}");
                return;
            }

            var loggerRenderers = new ILoggerImplementationRenderer[]
            {
                new LoggerImplementationRenderer(),
            }.Union(project.GetExtensions <ILoggerImplementationRenderer>()).ToArray();

            foreach (var renderer in loggerRenderers.Union(project.GetExtensions <ILoggerImplementationRenderer>()))
            {
                renderer.Render(project, loggerProjectItem);
            }
        }
        private void RenderLoggerImplementation(Project project, ProjectItem <LoggerModel> loggerProjectItem)
        {
            var loggerModel = loggerProjectItem.Content;

            if (loggerModel == null)
            {
                LogError(
                    $"{loggerProjectItem.Name} should have a content of type {typeof(LoggerModel).Name} set but found {loggerProjectItem.Content?.GetType().Name ?? "null"}");
                return;
            }

            var loggerRenderers = new ILoggerImplementationRenderer[]
            {
                new LoggerImplementationRenderer(),
            }.Union(project.GetExtensions <ILoggerImplementationRenderer>(loggerModel.EventSource.Settings?.Modules ?? new string[0])).ToArray();

            foreach (var renderer in loggerRenderers)
            {
                PassAlongLoggers(renderer as IWithLogging);
                renderer.Render(project, loggerProjectItem);
            }
        }