当前位置: 首页>>代码示例>>C#>>正文


C# ILoggerFactory.AddOrchardLogging方法代码示例

本文整理汇总了C#中ILoggerFactory.AddOrchardLogging方法的典型用法代码示例。如果您正苦于以下问题:C# ILoggerFactory.AddOrchardLogging方法的具体用法?C# ILoggerFactory.AddOrchardLogging怎么用?C# ILoggerFactory.AddOrchardLogging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILoggerFactory的用法示例。


在下文中一共展示了ILoggerFactory.AddOrchardLogging方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConfigureWebHost

        public static IApplicationBuilder ConfigureWebHost(
            this IApplicationBuilder builder,
            ILoggerFactory loggerFactory)
        {
            loggerFactory.AddOrchardLogging(builder.ApplicationServices);

            // Add diagnostices pages
            // TODO: make this modules or configurations
            builder.UseRuntimeInfoPage();
            builder.UseDeveloperExceptionPage();

            // Add static files to the request pipeline.
            builder.UseStaticFiles();

            // Ensure the shell tenants are loaded when a request comes in
            // and replaces the current service provider for the tenant's one.
            builder.UseMiddleware<OrchardContainerMiddleware>();

            // Route the request to the correct Orchard pipeline
            builder.UseMiddleware<OrchardRouterMiddleware>();

            // Load controllers
            var applicationPartManager = builder.ApplicationServices.GetRequiredService<ApplicationPartManager>();
            var extensionManager = builder.ApplicationServices.GetRequiredService<IExtensionManager>();
            foreach (var extension in extensionManager.AvailableExtensions())
            {
                var extensionEntry = extensionManager.LoadExtension(extension);
                applicationPartManager.ApplicationParts.Add(new AssemblyPart(extensionEntry.Assembly));
            }

            return builder;
        }
开发者ID:geertdoornbos,项目名称:Orchard2,代码行数:32,代码来源:ApplicationBuilderExtensions.cs

示例2: ConfigureWebHost

        public static IApplicationBuilder ConfigureWebHost(
            this IApplicationBuilder builder,
            ILoggerFactory loggerFactory)
        {
            loggerFactory.AddOrchardLogging(builder.ApplicationServices);

            builder.UseMiddleware<OrchardContainerMiddleware>();

            // Think this needs to be inserted in a different part of the pipeline, possibly
            // when DI is created for the shell
            builder.UseMiddleware<OrchardRouterMiddleware>();

            return builder;
        }
开发者ID:SmartFire,项目名称:Orchard2,代码行数:14,代码来源:ApplicationBuilderExtensions.cs

示例3: ConfigureWebHost

        public static IApplicationBuilder ConfigureWebHost(
            this IApplicationBuilder builder,
            ILoggerFactory loggerFactory)
        {
            loggerFactory.AddOrchardLogging(builder.ApplicationServices);

            // Add static files to the request pipeline.
            builder.UseStaticFiles();

            // Ensure the shell tenants are loaded when a request comes in
            // and replaces the current service provider for the tenant's one.
            builder.UseMiddleware<OrchardContainerMiddleware>();

            // Route the request to the correct Orchard pipeline
            builder.UseMiddleware<OrchardRouterMiddleware>();

            return builder;
        }
开发者ID:adwardliu,项目名称:Orchard2,代码行数:18,代码来源:ApplicationBuilderExtensions.cs

示例4: ConfigureWebHost

        public static IApplicationBuilder ConfigureWebHost(
            this IApplicationBuilder builder,
            ILoggerFactory loggerFactory)
        {
            loggerFactory.AddOrchardLogging(builder.ApplicationServices);

            // Add diagnostices pages
            // TODO: make this modules from configurations
            // builder.UseRuntimeInfoPage(); // removed!
            builder.UseDeveloperExceptionPage();

            // Add static files to the request pipeline.
            builder.UseStaticFiles();

            // Ensure the shell tenants are loaded when a request comes in
            // and replaces the current service provider for the tenant's one.
            builder.UseMiddleware<OrchardContainerMiddleware>();

            // Route the request to the correct tenant specific pipeline
            builder.UseMiddleware<OrchardRouterMiddleware>();

            // Load controllers
            var applicationPartManager = builder.ApplicationServices.GetRequiredService<ApplicationPartManager>();
            var extensionManager = builder.ApplicationServices.GetRequiredService<IExtensionManager>();

            var sw = Stopwatch.StartNew();

            Parallel.ForEach(extensionManager.AvailableFeatures(), feature =>
            {
                try
                {
                    var extensionEntry = extensionManager.LoadExtension(feature.Extension);
                    applicationPartManager.ApplicationParts.Add(new AssemblyPart(extensionEntry.Assembly));
                }
                catch
                {
                    // TODO: An extension couldn't be loaded, log
                }
            });

            Debug.WriteLine($"Overall time to dynamically compile and load extensions: {sw.Elapsed}");

            return builder;
        }
开发者ID:yanghl22,项目名称:Orchard2,代码行数:44,代码来源:ApplicationBuilderExtensions.cs

示例5: ConfigureWebHost

        public static IApplicationBuilder ConfigureWebHost(
            this IApplicationBuilder builder,
            ILoggerFactory loggerFactory)
        {
            loggerFactory.AddOrchardLogging(builder.ApplicationServices);

            // Add diagnostices pages
            // TODO: make this modules or configurations
            builder.UseRuntimeInfoPage();
            builder.UseDeveloperExceptionPage();

            // Add static files to the request pipeline.
            builder.UseStaticFiles();

            // Ensure the shell tenants are loaded when a request comes in
            // and replaces the current service provider for the tenant's one.
            builder.UseMiddleware<OrchardContainerMiddleware>();

            // Route the request to the correct Orchard pipeline
            builder.UseMiddleware<OrchardRouterMiddleware>();

            return builder;
        }
开发者ID:MichaelPetrinolis,项目名称:Orchard2,代码行数:23,代码来源:ApplicationBuilderExtensions.cs

示例6: ConfigureWebHost

        public static IApplicationBuilder ConfigureWebHost(
            this IApplicationBuilder builder,
            IHostingEnvironment hostingEnvironment,
            ILoggerFactory loggerFactory)
        {
            loggerFactory.AddOrchardLogging(builder.ApplicationServices);

            var extensionManager = builder.ApplicationServices.GetRequiredService<IExtensionManager>();

            // Add diagnostices pages
            // TODO: make this modules from configurations
            // builder.UseRuntimeInfoPage(); // removed!
            builder.UseDeveloperExceptionPage();

            // Add static files to the request pipeline.

            builder.UseStaticFiles();

            // TODO: configure the location and parameters (max-age) per module.
            foreach(var extension in extensionManager.AvailableExtensions())
            {
                var contentPath = Path.Combine(hostingEnvironment.ContentRootPath, extension.Location, extension.Id, "Content");
                if (Directory.Exists(contentPath))
                {
                    builder.UseStaticFiles(new StaticFileOptions()
                    {
                        RequestPath = "/" + extension.Id,
                        FileProvider = new PhysicalFileProvider(contentPath)
                    });
                }
            }

            // Ensure the shell tenants are loaded when a request comes in
            // and replaces the current service provider for the tenant's one.
            builder.UseMiddleware<OrchardContainerMiddleware>();

            // Route the request to the correct tenant specific pipeline
            builder.UseMiddleware<OrchardRouterMiddleware>();

            // Load controllers
            var applicationPartManager = builder.ApplicationServices.GetRequiredService<ApplicationPartManager>();

            var sw = Stopwatch.StartNew();

            Parallel.ForEach(extensionManager.AvailableFeatures(), feature =>
            {
                try
                {
                    var extensionEntry = extensionManager.LoadExtension(feature.Extension);
                    applicationPartManager.ApplicationParts.Add(new AssemblyPart(extensionEntry.Assembly));
                }
                catch
                {
                    // TODO: An extension couldn't be loaded, log
                }
            });

            var message = $"Overall time to dynamically compile and load extensions: {sw.Elapsed}";

            if (Debugger.IsAttached)
            {
                Debug.WriteLine(message);
            }
            else
            {
                Reporter.Output.WriteLine(message);
                Reporter.Output.WriteLine();
            }

            return builder;
        }
开发者ID:jchenga,项目名称:Orchard2,代码行数:71,代码来源:ApplicationBuilderExtensions.cs


注:本文中的ILoggerFactory.AddOrchardLogging方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。