Пример #1
0
        /// <summary>
        /// Configures logging to use the specified <see cref="LoggerConfiguration"/>.
        /// </summary>
        /// <param name="builder">The logging extension builder.</param>
        /// <param name="config">The logger configuration to use.</param>
        /// <returns>The <paramref name="builder"/>.</returns>
        public static IFacilityExtensionBuilder <ILoggingFacility, SerilogLoggingExtension> UseConfiguration(
            this IFacilityExtensionBuilder <ILoggingFacility, SerilogLoggingExtension> builder,
            LoggerConfiguration config)
        {
            Ensure.Arg.NotNull(builder, nameof(builder));
            builder.Configure(
                (f, e) =>
            {
                e.Logger  = config.CreateLogger();
                e.Dispose = true;
            });

            return(builder);
        }
Пример #2
0
        /// <summary>
        /// Configures logging to use the specified <see cref="Serilog.ILogger"/>.
        /// </summary>
        /// <param name="builder">The logging extension builder.</param>
        /// <param name="logger">The root logger to use.</param>
        /// <param name="dispose">Whether to dispose the logger.</param>
        /// <returns>The <paramref name="builder"/>.</returns>
        public static IFacilityExtensionBuilder <ILoggingFacility, SerilogLoggingExtension> UseLogger(
            this IFacilityExtensionBuilder <ILoggingFacility, SerilogLoggingExtension> builder,
            ILogger logger, bool dispose = false)
        {
            Ensure.Arg.NotNull(builder, nameof(builder));
            builder.Configure(
                (f, e) =>
            {
                e.Logger  = logger;
                e.Dispose = dispose;
            });

            return(builder);
        }
Пример #3
0
 public void Configure(Action <IDataFacility, EntityFrameworkCoreExtension <TTag, TDbContext> > configure)
 {
     _builder.Configure(configure);
 }