コード例 #1
0
        public void Scrape()
        {
            var formatter = new Serilog.Formatting.Json.JsonFormatter();

            Log.Logger = new LoggerConfiguration().MinimumLevel.Debug().MinimumLevel.Override("Microsoft", Serilog.Events.LogEventLevel.Information).Enrich.FromLogContext().WriteTo.Console().CreateLogger();

            timer.Interval = 1000; //1 second
            timer.Elapsed += Timer_Elapsed;
            timer.Start();
            isRunning = true;

            var random = new Random();

            while (isRunning)
            {
                Thread.Sleep(random.Next(10000));   //keeps app alive
            }
        }
コード例 #2
0
        public MariaContext()
        {
            var formatter = new Serilog.Formatting.Json.JsonFormatter();

            Log.Logger = new LoggerConfiguration().MinimumLevel.Debug().MinimumLevel.Override("Microsoft", Serilog.Events.LogEventLevel.Information).Enrich.FromLogContext().WriteTo.Console().CreateLogger();
        }