lib/semantic_logger/appender/tcp.rb in semantic_logger-4.1.1 vs lib/semantic_logger/appender/tcp.rb in semantic_logger-4.2.0
- old
+ new
@@ -186,16 +186,16 @@
connect_timeout: 10.0, read_timeout: 60.0, write_timeout: 60.0,
connect_retry_count: 10, retry_count: 3, connect_retry_interval: 0.5, close_on_error: true,
on_connect: nil, proxy_server: nil, ssl: nil,
level: nil, formatter: nil, filter: nil, application: nil, host: nil, &block
)
- @separator = separator
- @options = {
- server: server,
- servers: servers,
- policy: policy,
- buffered: buffered,
+ @separator = separator
+ @options = {
+ server: server,
+ servers: servers,
+ policy: policy,
+ buffered: buffered,
#keepalive: keepalive,
connect_timeout: connect_timeout,
read_timeout: read_timeout,
write_timeout: write_timeout,
connect_retry_count: connect_retry_count,
@@ -206,11 +206,11 @@
proxy_server: proxy_server,
ssl: ssl
}
# Use the internal logger so that errors with remote logging are only written locally.
- Net::TCPClient.logger = SemanticLogger::Processor.logger.clone
+ Net::TCPClient.logger = logger
Net::TCPClient.logger.name = 'Net::TCPClient'
super(level: level, formatter: formatter, filter: filter, application: application, host: host, &block)
reopen
end
@@ -221,11 +221,9 @@
@tcp_client = Net::TCPClient.new(@options)
end
# Write the log using the specified protocol and server.
def log(log)
- return false unless should_log?(log)
-
message = formatter.call(log, self)
@tcp_client.retry_on_connection_failure do
@tcp_client.write("#{message}#{separator}")
end
true