protected void Cleanup() { if (_stream != null) { _stream.Dispose(); _stream = null; } if (_endpoint != null) { _endpoint.Dispose(); _endpoint = null; } _emitter = null; }
protected void Cleanup() { if (_stream != null) { _stream.Dispose(); _stream = null; } if (_tcpClient != null) { _tcpClient.Client.Dispose(); _tcpClient = null; } _emitter = null; }
protected async void EnsureConnected() { try { if (!_tcpClient.Connected) { await _tcpClient.ConnectAsync(_options.Host, _options.Port); _stream = _tcpClient.GetStream(); _emitter = new FluentdEmitter(_stream); } } catch (Exception ex) { var e = ex; } }
protected async void EnsureConnected() { try { if (IsConnected()) { return; } InitializeTcpClient(); await _tcpClient.ConnectAsync(_options.Host, _options.Port); _stream = _tcpClient.GetStream(); _emitter = new FluentdEmitter(_stream); } catch (Exception ex) { SelfLog.WriteLine($"[Serilog.Sinks.Fluentd] Connection exception {ex.Message}\n{ex.StackTrace}"); } }
protected async Task EnsureConnectedAsync() { try { bool endpointInitialzied = _endpoint?.IsConnected() ?? false; if (endpointInitialzied) { return; } InitializeEndpoint(); await _endpoint.ConnectAsync(); _stream = _endpoint.GetStream(); _emitter = new FluentdEmitter(_stream); } catch (Exception ex) { SelfLog.WriteLine($"[Serilog.Sinks.Fluentd] Connection exception {ex.Message}\n{ex.StackTrace}"); } }
protected async Task EnsureConnectedAsync() { try { if (UsefulTimeExpired()) { Cleanup(); } bool endpointInitialzied = _endpoint?.IsConnected() ?? false; if (endpointInitialzied) { return; } if (CanNotConnect()) { return; } InitializeEndpoint(); await _endpoint.ConnectAsync(); _lastConnectAttempt = DateTime.Now; _stream = _endpoint.GetStream(); _emitter = new FluentdEmitter(_stream); } catch (Exception ex) { _lastConnectAttempt = DateTime.Now; SelfLog.WriteLine($"[Serilog.Sinks.Fluentd] Connection exception {ex.Message}\n{ex.StackTrace}"); } }