Ejemplo n.º 1
0
        public BatchLogPoster(LugerLogOptions config, HttpClient httpClient)
        {
            timer          = new Timer(config.BatchPostInterval.TotalMilliseconds);
            timer.Elapsed += delegate { TriggerBatchPost().Wait(); };
            timer.Start();

            thislock        = new();
            queue           = new Queue <LogRecord>(1024);
            this.config     = config;
            this.httpClient = httpClient;
        }
Ejemplo n.º 2
0
        public LugerLogProvider(LugerLogOptions config)
        {
            if (config.LugerUrl is null)
            {
                throw new ArgumentNullException($"{nameof(LugerLogOptions)}.{nameof(LugerLogOptions.LugerUrl)} is null");
            }
            if (config.Bucket is null)
            {
                throw new ArgumentNullException($"{nameof(LugerLogOptions)}.{nameof(LugerLogOptions.Bucket)} is null");
            }

            this.config = config;

            clientHandler = new HttpClientHandler
            {
                MaxConnectionsPerServer = config.MaxConnectionsPerServer,
                Proxy    = config.Proxy,
                UseProxy = config.UseProxy
            };
            batchPoster = new BatchLogPoster(config, new HttpClient(clientHandler)
            {
                BaseAddress = config.LugerUrl
            });
        }