本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}