Inheritance: IDisposable
Beispiel #1
0
        public static async Task <FluentSender> CreateSync(string tag, string host = "localhost", int port = 24224, int bufmax = 1024 *1024, int timeout = 3000, bool verbose = false, int autoretryinterval = 10000)
        {
            var sender = new FluentSender(tag, host, port, bufmax, timeout, verbose);

            await sender.InitializeAsync();

            return(sender);
        }
        public static async Task<FluentSender> CreateSync(string tag, string host = "localhost", int port = 24224, int bufmax = 1024*1024, int timeout = 3000, bool verbose = false, int autoretryinterval = 10000)
        {
            var sender = new FluentSender(tag, host, port, bufmax, timeout, verbose);

            await sender.InitializeAsync();

            return sender;
        }
        public FluentLoggerFactoryAdapter(NameValueCollection properties)
            : base(properties)
        {
            string tag = (string)properties.ParseValue("tag") ?? "Fluent";
            string hostname = (string)properties.ParseValue("hostname") ?? "localhost";
            int port = properties.ParseValueOrDefault("port", 24224);
            int bufmax = properties.ParseValueOrDefault("bufmax", 1024 * 1024);
            int timeout = properties.ParseValueOrDefault("timeout", 3000);
            bool verbose = properties.ParseValueOrDefault("verbose", false);

            _sender = FluentSender.CreateSync(tag, hostname, port, bufmax, timeout, verbose).Result;

            _queue = new BlockingCollection<Tuple<string, object>>(new ConcurrentQueue<Tuple<string, object>>());
            _cancellation = new CancellationTokenSource();

            Task.Factory.StartNew(WriteLog, _cancellation);
        }