Exemplo n.º 1
0
        public static LoggerConfiguration CreateDefaultConfiguration(this SerilogSeqAuditClientConfiguration config, HttpMessageHandler messageHandler = null)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

            var configBuilder = new LoggerConfiguration()
                                .AuditTo.Seq(config.ServerUrl.ToString(), apiKey: config.ApiKey, messageHandler: messageHandler, compact: true);

            if (config.EnrichFromLogContext == true)
            {
                configBuilder = configBuilder.Enrich.FromLogContext();
            }

            return(configBuilder);
        }
Exemplo n.º 2
0
 public SerilogSeqAuditClient(SerilogSeqAuditClientConfiguration config, HttpMessageHandler messageHandler = null)
 {
     this.logger        = config.CreateDefaultConfiguration(messageHandler).CreateLogger();
     this.disposeLogger = true;
     this.audit         = new SerilogLoggerAudit(this.logger);
 }