• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ILoggerFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: EndpointHandler

 public EndpointHandler(ILoggerFactory loggerFactory)
 {
     this._log = loggerFactory.Create(this);
     this._idByToken = new Dictionary<string, Identity>();
     this._callbacks = new Dictionary<int, SendCallback>();
     this._onMessage = new EventHandler<ChannelContext>(this.OnMessage);
 }
开发者ID:fengxianqi,项目名称:Youbang,代码行数:7,代码来源:EndpointHandler.cs


示例2: Configure

        // Configure is called after ConfigureServices is called.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.MinimumLevel = LogLevel.Information;
            loggerFactory.AddConsole();

            // Configure the HTTP request pipeline.

            // Add the following to the request pipeline only in development environment.
            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseErrorPage(ErrorPageOptions.ShowAll);
            }
            else
            {
                // Add Error handling middleware which catches all application specific errors and
                // send the request to the following path or controller action.
                app.UseErrorHandler("/Home/Error");
            }

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

            // Add MVC to the request pipeline.
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");

                // Uncomment the following line to add a route for porting Web API 2 controllers.
                // routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
            });
        }
开发者ID:nkkn1008,项目名称:vs-soul-github,代码行数:35,代码来源:Startup.cs


示例3: AccountController

 public AccountController(IConfigurationRoot appSettings, UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, ILoggerFactory loggerFactory)
 {
     _appSettings = appSettings;
     _userManager = userManager;
     _signInManager = signInManager;
     _logger = loggerFactory.CreateLogger<AccountController>();
 }
开发者ID:pmalmeida,项目名称:AspNet5AngularV2,代码行数:7,代码来源:AccountController.cs


示例4: Configure

 public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
 {
     loggerFactory.AddConsole();
     app.UseIISPlatformHandler();
     app.UseStaticFiles();
     app.UseWelcomePage();
 }
开发者ID:leloulight,项目名称:Home,代码行数:7,代码来源:Startup.cs


示例5: Configure

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IConfigurationRoot configuration)
        {
            loggerFactory.AddConsole(configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            // For more details on creating database during deployment see http://go.microsoft.com/fwlink/?LinkID=615859
            try
            {
                using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>()
                    .CreateScope())
                {
                    using (var db = serviceScope.ServiceProvider.GetService<ApplicationDbContext>())
                    {
                        db.Database.EnsureCreated();
                        db.Database.Migrate();
                    }
                }
            }
            catch (Exception exception)
            {
            }

            app.UseCors("AllowAllOrigins");         // TODO: allow collection of allowed origins per client
            app.UseIISPlatformHandler();
            app.UseStaticFiles();
            app.UseMvc();
        }
开发者ID:JGaudion,项目名称:openidconnect,代码行数:27,代码来源:Startup.cs


示例6: Configure

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            SuperDataBase.Configure(env, app.ApplicationServices.GetService<IOptions<AppConfig>>());

            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseIISPlatformHandler();

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

        }
开发者ID:marcodiniz,项目名称:TinBot,代码行数:30,代码来源:Startup.cs


示例7: DBTaskQueue

 internal DBTaskQueue(
     string dbConnectionString,
     ILoggerFactory loggerFactory)
 {
     logFactory = loggerFactory;
     connectionString = dbConnectionString;
 }
开发者ID:okusnadi,项目名称:cloudscribe,代码行数:7,代码来源:DBTaskQueue.cs


示例8: DefaultVirtualPathProvider

 public DefaultVirtualPathProvider(
     IHostEnvironment hostEnvironment,
     ILoggerFactory loggerFactory)
 {
     _hostEnvironment = hostEnvironment;
     _logger = loggerFactory.CreateLogger<DefaultVirtualPathProvider>();
 }
开发者ID:mkinawy,项目名称:Orchard2,代码行数:7,代码来源:DefaultVirtualPathProvider.cs


示例9: Configure

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            app.UseMvc();
        }
开发者ID:XentrinaEnterpriseSolutions,项目名称:Xentrina,代码行数:8,代码来源:Startup.cs


示例10: Configure

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.MinimumLevel = LogLevel.Debug;
            loggerFactory.AddConsole();

            ConfigureApplication(app);
        }
开发者ID:MarkGravestock,项目名称:ReadingListApi,代码行数:7,代码来源:Startup.cs


示例11: Configure

        // Configure is called after ConfigureServices is called.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();
            
            // Add the following to the request pipeline only in development environment.
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // Add Error handling middleware which catches all application specific errors and
                // send the request to the following path or controller action.
                app.UseExceptionHandler("/Home/Error");
            }

            // Add the platform handler to the request pipeline.
            app.UseIISPlatformHandler();

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

            // Add MVC to the request pipeline.
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
                    
                routes.MapRoute("DefaultApi", "api/{controller}/{id?}");
            });
        }
开发者ID:zplanet,项目名称:expense-tracker-net,代码行数:34,代码来源:Startup.cs


示例12: Configure

 // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
 public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
 {
     app.Run(async (context) =>
     {
         await context.Response.WriteAsync("Hello World!");
     });
 }
开发者ID:DanWahlin,项目名称:ASP.NET5Demos,代码行数:8,代码来源:Startup.cs


示例13: Configure

        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear();

            loggerFactory.AddConsole();
            loggerFactory.AddDebug();

            app.UseDeveloperExceptionPage();
            app.UseStaticFiles();

            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationScheme = "Cookies",
                AutomaticAuthenticate = true
            });

            app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
            {
                AuthenticationScheme = "oidc",
                SignInScheme = "Cookies",

                Authority = "https://demo.identityserver.io",
                PostLogoutRedirectUri = "http://localhost:3308/",
                ClientId = "hybrid",
                ClientSecret = "secret",
                ResponseType = "code id_token",
                GetClaimsFromUserInfoEndpoint = true,
                SaveTokens = true
            });

            app.UseMvcWithDefaultRoute();
        }
开发者ID:ReinhardHsu,项目名称:AspNetCoreSecuritySamples,代码行数:32,代码来源:Startup.cs


示例14: Configure

        // Configure is called after ConfigureServices is called.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            if(env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            
            loggerFactory
                .AddConsole(Configuration.GetSection("Logging"))
                .AddDebug();
            
            // Use the Default files ['index.html', 'index.htm', 'default.html', 'default.htm']
            app.UseDefaultFiles()
                .UseStaticFiles()
                .UseIISPlatformHandler()
                .UseMvc();

            // Setup a generic Quotes API EndPoint
            app.Map("/api/quotes", (config) =>
            {
                app.Run(async context =>
                {
                    var quotes = "{ \"quotes\":" +
                                 " [ { \"quote\": \"Duct tape is like the force. It has a light side, a dark side, and it holds the universe together.\", \"author\":\"Oprah Winfrey\"} ]" +
                                 "}";
                    context.Response.ContentLength = quotes.Length;
                    context.Response.ContentType = "application/json";                    
                    await context.Response.WriteAsync(quotes);
                });
            });
        }
开发者ID:jtucker,项目名称:aspnet5-angular2-starter,代码行数:32,代码来源:Startup.cs


示例15: Configure

        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IApplicationEnvironment env)
        {
            var ksi = app.ServerFeatures.Get<IKestrelServerInformation>();
            ksi.NoDelay = true;

            loggerFactory.AddConsole(LogLevel.Error);

            app.UseKestrelConnectionLogging();

            app.Run(async context =>
            {
                Console.WriteLine("{0} {1}{2}{3}",
                    context.Request.Method,
                    context.Request.PathBase,
                    context.Request.Path,
                    context.Request.QueryString);
                Console.WriteLine($"Method: {context.Request.Method}");
                Console.WriteLine($"PathBase: {context.Request.PathBase}");
                Console.WriteLine($"Path: {context.Request.Path}");
                Console.WriteLine($"QueryString: {context.Request.QueryString}");

                var connectionFeature = context.Connection;
                Console.WriteLine($"Peer: {connectionFeature.RemoteIpAddress?.ToString()} {connectionFeature.RemotePort}");
                Console.WriteLine($"Sock: {connectionFeature.LocalIpAddress?.ToString()} {connectionFeature.LocalPort}");

                var content = $"Hello world!{Environment.NewLine}Received '{Args}' from command line.";
                context.Response.ContentLength = content.Length;
                context.Response.ContentType = "text/plain";
                await context.Response.WriteAsync(content);
            });
        }
开发者ID:krwq,项目名称:cli,代码行数:31,代码来源:Startup.cs


示例16: Configure

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            loggerFactory.AddDebug();
    
            var section = Configuration.GetSection("MongoDB");
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseIISPlatformHandler();
            app.UseCors("AllowAll");
            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                  name:"api",
                  template: "api/{controller}/{id?}"  
                );
             });
        }
开发者ID:DarriusWrightGD,项目名称:ASP.NET-Core-Angular2,代码行数:28,代码来源:Startup.cs


示例17: Configure

        // Configure is called after ConfigureServices is called.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerfactory)
        {
            // Configure the HTTP request pipeline.

            // Add the console logger.
            loggerfactory.AddConsole(minLevel: LogLevel.Verbose);

            // Add the following to the request pipeline only in development environment.
            if (env.IsEnvironment("Development"))
            {
                app.UseBrowserLink();
                app.UseErrorPage(ErrorPageOptions.ShowAll);
            }
            else
            {
                // Add Error handling middleware which catches all application specific errors and
                // send the request to the following path or controller action.
                app.UseErrorHandler("/Home/Error");
            }

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

            // Add MVC to the request pipeline.
            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
            SampleData.Initialize(app.ApplicationServices);
        }
开发者ID:bigfont,项目名称:Docs,代码行数:33,代码来源:Startup.cs


示例18: DBUserLogins

 internal DBUserLogins(
     string dbConnectionString,
     ILoggerFactory loggerFactory)
 {
     logFactory = loggerFactory;
     connectionString = dbConnectionString;
 }
开发者ID:ruelbtit2014,项目名称:cloudscribe,代码行数:7,代码来源:DBUserLogins.cs


示例19: CommonExceptionHandlerMiddleware

 public CommonExceptionHandlerMiddleware(
     RequestDelegate next,
     ILoggerFactory loggerFactory,
     DiagnosticSource diagnosticSource,
     IOptions<ExceptionHandlerOptions> options = null
     )
 {
     _next = next;
     if(options == null)
     {
         _options = new ExceptionHandlerOptions();
     }
     else
     {
         _options = options.Value;
     }
     
     _logger = loggerFactory.CreateLogger<CommonExceptionHandlerMiddleware>();
     if (_options.ExceptionHandler == null)
     {
         _options.ExceptionHandler = _next;
     }
     _clearCacheHeadersDelegate = ClearCacheHeaders;
     _diagnosticSource = diagnosticSource;
 }
开发者ID:ReinhardHsu,项目名称:cloudscribe,代码行数:25,代码来源:CommonExceptionHandlerMiddleware.cs


示例20: Configure

        // Configure is called after ConfigureServices is called.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            loggerFactory.MinimumLevel = LogLevel.Information;

            // Add the following to the request pipeline only in development environment.
            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                //app.UseErrorPage(ErrorPageOptions.ShowAll);
            }
            else
            {
                // Add Error handling middleware which catches all application specific errors and
                // sends the request to the following path or controller action.
                //app.UseErrorHandler("/Home/Error");
            }

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

            // Add MVC to the request pipeline.
            app.UseMvc(routes =>
            {
            });

            app.UseMvc();
        }
开发者ID:Richiban,项目名称:Marketplace2.0,代码行数:28,代码来源:Startup.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ILoggerRepository类代码示例发布时间:2022-05-24
下一篇:
C# ILoggerFacade类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap