Beispiel #1
0
 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;
 }
Beispiel #2
0
 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)
     {
     }
 }
Beispiel #3
0
 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;
     }
 }
Beispiel #4
0
        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);
        }
Beispiel #5
0
 private void ConnectClient()
 {
     this.client.Connect(this.Host, this.Port);
     this.stream  = this.client.GetStream();
     this.emitter = new FluentdEmitter(this.stream);
 }