Esempio n. 1
0
        public FluentdPacker(IFluentdOptions options)
        {
            this.options = options;

            serializationContext = new SerializationContext(PackerCompatibilityOptions.PackBinaryAsRaw)
            {
                SerializationMethod = SerializationMethod.Map
            };
        }
Esempio n. 2
0
        public FluentdClient(
            IFluentdPacker packer,
            IFluentdOptions options,
            IFluentdClientTimer timer)
        {
            this.packer  = packer;
            this.options = options;
            this.timer   = timer;

            syncObj   = new object();
            quietTime = TimeSpan.Zero;

            this.timer.SetupTimer(new TimerCallback(async(target) =>
            {
                if (logEvents != null && logEvents.Any())
                {
                    await FlushEvents();

                    quietTime = TimeSpan.Zero;
                }
                else
                {
                    if (connected)
                    {
                        quietTime += options.FlushTime;

                        if (quietTime >= options.DisconnectTime)
                        {
                            ConsoleColor.Yellow.OutputMessage($"{typeof(FluentdClient).FullName} {nameof(timer)} -> No logs for: {quietTime} disposing client. On thread with id `{Thread.CurrentThread.ManagedThreadId}`"
                                                              , debug: options.Debug.On
                                                              , path: options.Debug.Path);

                            Dispose();
                        }
                    }
                }
            }), options.FlushTime);
        }
Esempio n. 3
0
 public FluentdLogger(IEnumerable <ILogSerializer> serializers, IFluentdClient client, IFluentdOptions options)
 {
     this.serializers = serializers;
     this.client      = client;
     this.options     = options;
 }