public WhisperApplication() { if (!Directory.Exists(LoggingDirectory)) { Directory.CreateDirectory(LoggingDirectory); } if (!Directory.Exists(ConfigDirectory)) { Directory.CreateDirectory(ConfigDirectory); } _loggingService = new LoggingServiceProvider(LoggingDirectory); _appInfoService = new ApplicationInfoServiceProvider(); _clipboardService = new ClipboardServiceProvider(); _configService = new ConfigurationServiceProvider(_loggingService); _generatorService = new GeneratorServiceProvider(); _services = new List <IApplicationService> { _appInfoService, _clipboardService, _configService, _generatorService }; _logger = _loggingService.GetContextualLogger("Initialisation"); }
public static void UseCosmosLogging(this Database db, Func <string, LogEventLevel, bool> filter, Func <string, object> loggerAct = null) { if (db == null) { throw new ArgumentNullException(nameof(db)); } Func <string, LogEventLevel, bool> localFilter = (s, l) => (Settings?.Filter?.Invoke(s, l) ?? true) && (filter?.Invoke(s, l) ?? true); var internalLogger = LoggingServiceProvider?.GetLogger <Database>(localFilter); if (internalLogger == null) { return; } var localFunc = GlobalSimpleLoggingInterceptor; localFunc += loggerAct; var logger = new SimpleLogger(internalLogger, localFunc); db.Log += s => logger.WriteLog(s, db.Connection.Database); }