Ejemplo n.º 1
0
        private bool _disposedValue = false; // To detect redundant calls

        #endregion Fields

        #region Constructors

        public SerilogLoggerScope(SerilogLoggerProvider provider, SerilogLoggerScope parent, string name, object state)
        {
            _provider = provider;
            Name = name;
            State = state;

            Parent = _provider.CurrentScope;
            _provider.CurrentScope = this;
        }
Ejemplo n.º 2
0
        private Tuple<SerilogLogger, SerilogSink> SetUp(LogLevel logLevel)
        {
            // Arrange
            var serilog = new LoggerConfiguration()
                .Enrich.WithMachineName()
                .Enrich.WithProcessId()
                .Enrich.WithThreadId();
            serilog = SetMinLevel(serilog, logLevel);
            var sink = new SerilogSink();
            serilog.WriteTo.Sink(sink);
            var provider = new SerilogLoggerProvider(serilog);
            var logger = (SerilogLogger)provider.CreateLogger(_name);

            return new Tuple<SerilogLogger, SerilogSink>(logger, sink);
        }