| 123456789101112131415161718192021222324252627282930313233 |
- using Microsoft.Extensions.Logging;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- namespace Winsoft.GOV.XF.WebApi.WXCore.Helpers
- {
- public static class Utilities
- {
- static ILoggerFactory _loggerFactory;
- public static void ConfigureLogger(ILoggerFactory loggerFactory)
- {
- _loggerFactory = loggerFactory;
- }
- public static ILogger CreateLogger<T>()
- {
- if (_loggerFactory == null)
- {
- throw new InvalidOperationException($"{nameof(ILogger)} is not configured. {nameof(ConfigureLogger)} must be called before use");
- //_loggerFactory = new LoggerFactory().AddConsole().AddDebug();
- }
- return _loggerFactory.CreateLogger<T>();
- }
- public static string ContentRootPath { get; set; }
- }
- }
|