protected void Cleanup() { if (this.stream != null) { this.stream.Dispose(); this.stream = null; } if (this.client != null) { this.client.Close(); this.client = null; } this.emitter = null; }
protected void EnsureConnected() { try { if (!client.Connected) { client.Connect(this.Host, this.Port); this.stream = this.client.GetStream(); this.emitter = new FluentdEmitter(this.stream); } } catch (Exception e) { } }
protected void Cleanup() { try { this.stream?.Dispose(); this.client?.Close(); } catch (Exception ex) { NLog.Common.InternalLogger.Warn("Fluentd Close - " + ex.ToString()); } finally { this.stream = null; this.client = null; this.emitter = null; } }
private void ConnectClient(LogEventInfo lastEvent) { string host = Host.Render(lastEvent); string portString = Port.Render(lastEvent); if (string.IsNullOrWhiteSpace(host)) { throw new NLogConfigurationException("The Host is missing."); } if (!int.TryParse(portString, out int port)) { throw new NLogConfigurationException("The Port must be a number."); } this.client.Connect(host, port); this.stream = this.client.GetStream(); this.emitter = new FluentdEmitter(this.stream); }
private void ConnectClient() { this.client.Connect(this.Host, this.Port); this.stream = this.client.GetStream(); this.emitter = new FluentdEmitter(this.stream); }