protected void SetupLogger(IPipelines pipelines, TinyIoCContainer container) { var loggerBuilder = new LoggerBuilder(); Log.Logger = loggerBuilder .UseSuggestedSetting(Api.ApiSettings?.Domain, Api.ApiSettings?.Application) .SetupSeq(Api.LogSettings?.SeqOptions) .SetupSplunk(Api.LogSettings?.SplunkOptions) .SetupGoogleCloudLogging(Api.LogSettings?.GoogleCloudLoggingOptions) .BuildLogger(); var logger = container.Resolve <ICommunicationLogger>(); logger.NancySerilogConfiguration.InformationTitle = Api.LogSettings?.TitlePrefix + CommunicationLogger.DefaultInformationTitle; logger.NancySerilogConfiguration.ErrorTitle = Api.LogSettings?.TitlePrefix + CommunicationLogger.DefaultErrorTitle; logger.NancySerilogConfiguration.Blacklist = Api.LogSettings?.JsonBlacklist; if (Api.LogSettings?.DebugEnabled ?? false) { loggerBuilder.EnableDebug(); } pipelines.AddLogPipelines(container); }
public static void AddLogPipelines_Should_Throws_Exception_When_Pipeline_Is_Null() { // arrange IPipelines pipelines = null; TinyIoCContainer container = new TinyIoCContainer(); // act var exception = Assert.Throws <ArgumentNullException>(() => pipelines.AddLogPipelines(container)); // assert Assert.Equal("Value cannot be null.Parameter name: pipelines", exception.Message.Replace("\r", "").Replace("\n", "")); }