Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ Use nonblocking write(`IO#write_nonblock`) instead of normal write(`IO#write`).

If `false`, `Logger#post` raises an error when nonblocking write gets `EAGAIN` (i.e. `use_nonblock` must be `true`, otherwise this will have no effect). Default: `true`

#### connect_timeout (Integer)

Specify timeout in seconds from connecting. Default: `nil`

#### resolve_timeout (Integer)

Specify timeout in seconds from when the hostname resolution starts. Default: `nil`

#### buffer_overflow_handler (Proc)

Pass callback for handling buffer overflow with pending data. See "Buffer overflow" section.
Expand Down
2 changes: 2 additions & 0 deletions fluent-logger.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Gem::Specification.new do |gem|
gem.require_paths = ['lib']
gem.license = "Apache-2.0"

gem.required_ruby_version = '>= 2.7'

gem.add_dependency "msgpack", ">= 1.0.0", "< 2"

# logger gem that isn't default gems as of Ruby 3.5
Expand Down
5 changes: 4 additions & 1 deletion lib/fluent/logger/fluent_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ def initialize(tag_prefix = nil, *args)
@wait_writeable = true
@wait_writeable = options[:wait_writeable] if options.key?(:wait_writeable)

@connect_timeout = options[:connect_timeout]
@resolv_timeout = options[:resolv_timeout]

@last_error = {}

begin
Expand Down Expand Up @@ -170,7 +173,7 @@ def create_socket!
if @socket_path
@con = UNIXSocket.new(@socket_path)
else
@con = TCPSocket.new(@host, @port)
@con = Socket.tcp(@host, @port, connect_timeout: @connect_timeout, resolv_timeout: @resolv_timeout)
if @tls_options
context = OpenSSL::SSL::SSLContext.new
if @tls_options[:insecure]
Expand Down
Loading