Exemple #1
0
        public async Task Start()
        {
            var settings = new CatchUpSubscriptionSettings(
                2000
                , 500
                , _log.IsEnabled(LogEventLevel.Debug)
                , false);

            _log.Information("Starting the subscription manager...");

            var position = await _checkpointStore.GetCheckpoint();

            _log.Information("Retrieved the checkpoint: {checkpoint}", position);

            var _subscription = _connection.SubscribeToAllFrom(position
                                                               , settings
                                                               , EventAppeared
                                                               , LiveProcessingStarted
                                                               , SubscriptionDropped);

            // var _subscription = _connection.SubscribeToStreamFrom("$all"
            //                                                         ,position.Value.CommitPosition
            //                                                         , settings
            //                                                         , EventAppeared
            //                                                         , LiveProcessingStarted
            //                                                         , SubscriptionDropped);

            _log.Information("Subscribed to $all stream");
        }
Exemple #2
0
 public void Serilog_WithIf()
 {
     if (_sLogger.IsEnabled(Serilog.Events.LogEventLevel.Information))
     {
         _sLogger.Information(Message, 2022);
     }
 }
Exemple #3
0
            public bool WriteCore(TraceEventType eventType, int eventId, object state, Exception exception, Func <object, Exception, string> formatter)
            {
                var level = _getLogEventLevel(eventType);

                // According to docs http://katanaproject.codeplex.com/SourceControl/latest#src/Microsoft.Owin/Logging/ILogger.cs
                // "To check IsEnabled call WriteCore with only TraceEventType and check the return value, no event will be written."
                if (state == null)
                {
                    return(_logger.IsEnabled(level));
                }
                if (!_logger.IsEnabled(level))
                {
                    return(false);
                }
                _logger.Write(level, exception, formatter(state, exception));
                return(true);
            }
Exemple #4
0
            public bool WriteCore(TraceEventType eventType, int eventId, object state, Exception exception, Func <object, Exception, string> formatter)
            {
                var level = _getLogEventLevel(eventType);

                if (state == null)
                {
                    return(_logger.IsEnabled(level));
                }

                if (!_logger.IsEnabled(level))
                {
                    return(false);
                }

                _logger.Write(level, exception, formatter(state, exception));

                return(true);
            }
Exemple #5
0
        public SerilogLogger()
        {
            _log = new LoggerConfiguration()
                .MinimumLevel.Debug()
                .WriteTo.File("c:\\temp\\log.txt")
                .CreateLogger();

            var isdebug = _log.IsEnabled(LogEventLevel.Debug);
        }
        public void Start()
        {
            var settings = new CatchUpSubscriptionSettings(
                2000,
                500,
                Log.IsEnabled(LogEventLevel.Verbose),
                true,
                "try-out-subscription");

            _subscription = _connection.SubscribeToAllFrom(Position.Start, settings, EventAppeared);
        }
Exemple #7
0
 public void Trace(string template, params object[] values)
 {
     if (_inner.IsEnabled(LogEventLevel.Verbose))
     {
         _inner.Verbose(template, values);
     }
 }
Exemple #8
0
 public void LogWrite(string methodInfo, LogEventLevel level, string messageTemplate)
 {
     if (_logger.IsEnabled(level))
     {
         DoLog(methodInfo, level, null, messageTemplate, null);
     }
 }
Exemple #9
0
        public bool IsEnabled(LogLevel logLevel)
        {
            var level = ConvertLogLevel(logLevel);

            return(_logger.IsEnabled(level));
        }