semantic_logger 4.6.1 → 4.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +7 -7
- data/lib/semantic_logger.rb +23 -22
- data/lib/semantic_logger/appender.rb +32 -33
- data/lib/semantic_logger/appender/async.rb +9 -8
- data/lib/semantic_logger/appender/async_batch.rb +4 -2
- data/lib/semantic_logger/appender/bugsnag.rb +43 -30
- data/lib/semantic_logger/appender/elasticsearch.rb +10 -10
- data/lib/semantic_logger/appender/elasticsearch_http.rb +4 -4
- data/lib/semantic_logger/appender/file.rb +2 -1
- data/lib/semantic_logger/appender/graylog.rb +12 -10
- data/lib/semantic_logger/appender/honeybadger.rb +3 -3
- data/lib/semantic_logger/appender/http.rb +20 -18
- data/lib/semantic_logger/appender/kafka.rb +5 -5
- data/lib/semantic_logger/appender/mongodb.rb +6 -6
- data/lib/semantic_logger/appender/new_relic.rb +2 -2
- data/lib/semantic_logger/appender/rabbitmq.rb +5 -5
- data/lib/semantic_logger/appender/sentry.rb +7 -7
- data/lib/semantic_logger/appender/splunk.rb +5 -5
- data/lib/semantic_logger/appender/splunk_http.rb +4 -4
- data/lib/semantic_logger/appender/syslog.rb +20 -14
- data/lib/semantic_logger/appender/tcp.rb +5 -5
- data/lib/semantic_logger/appender/udp.rb +2 -2
- data/lib/semantic_logger/appenders.rb +11 -11
- data/lib/semantic_logger/base.rb +52 -23
- data/lib/semantic_logger/formatters.rb +11 -11
- data/lib/semantic_logger/formatters/base.rb +8 -3
- data/lib/semantic_logger/formatters/color.rb +10 -6
- data/lib/semantic_logger/formatters/default.rb +18 -5
- data/lib/semantic_logger/formatters/fluentd.rb +3 -3
- data/lib/semantic_logger/formatters/json.rb +1 -1
- data/lib/semantic_logger/formatters/raw.rb +31 -7
- data/lib/semantic_logger/formatters/signalfx.rb +10 -9
- data/lib/semantic_logger/formatters/syslog.rb +7 -6
- data/lib/semantic_logger/formatters/syslog_cee.rb +7 -6
- data/lib/semantic_logger/jruby/garbage_collection_logger.rb +4 -2
- data/lib/semantic_logger/levels.rb +9 -7
- data/lib/semantic_logger/log.rb +52 -60
- data/lib/semantic_logger/logger.rb +6 -8
- data/lib/semantic_logger/metric/new_relic.rb +3 -3
- data/lib/semantic_logger/metric/signalfx.rb +3 -3
- data/lib/semantic_logger/metric/statsd.rb +7 -7
- data/lib/semantic_logger/processor.rb +7 -5
- data/lib/semantic_logger/reporters/minitest.rb +4 -4
- data/lib/semantic_logger/semantic_logger.rb +24 -11
- data/lib/semantic_logger/subscriber.rb +6 -5
- data/lib/semantic_logger/sync.rb +12 -0
- data/lib/semantic_logger/sync_processor.rb +43 -0
- data/lib/semantic_logger/utils.rb +6 -6
- data/lib/semantic_logger/version.rb +1 -1
- metadata +9 -7
@@ -64,7 +64,8 @@ module SemanticLogger
|
|
64
64
|
@log = io
|
65
65
|
else
|
66
66
|
@file_name = file_name
|
67
|
-
raise
|
67
|
+
raise "SemanticLogging::Appender::File missing mandatory parameter :file_name or :io" unless file_name
|
68
|
+
|
68
69
|
reopen
|
69
70
|
end
|
70
71
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require "uri"
|
2
2
|
begin
|
3
|
-
require
|
3
|
+
require "gelf"
|
4
4
|
rescue LoadError
|
5
|
-
raise LoadError
|
5
|
+
raise LoadError, 'Gem gelf is required for logging to Graylog. Please add the gem "gelf" to your Gemfile.'
|
6
6
|
end
|
7
7
|
|
8
8
|
# Forward log entries to a Graylog server.
|
@@ -82,8 +82,8 @@ module SemanticLogger
|
|
82
82
|
# application: [String]
|
83
83
|
# Name of this application to appear in log messages.
|
84
84
|
# Default: SemanticLogger.application
|
85
|
-
def initialize(url:
|
86
|
-
max_size:
|
85
|
+
def initialize(url: "udp://localhost:12201",
|
86
|
+
max_size: "WAN",
|
87
87
|
gelf_options: {},
|
88
88
|
level_map: LevelMap.new,
|
89
89
|
**args,
|
@@ -105,7 +105,9 @@ module SemanticLogger
|
|
105
105
|
@port = uri.port
|
106
106
|
@protocol = uri.scheme.to_sym
|
107
107
|
|
108
|
-
|
108
|
+
unless %i[udp tcp].include?(@protocol)
|
109
|
+
raise(ArgumentError, "Invalid protocol value: #{@protocol}. Must be :udp or :tcp")
|
110
|
+
end
|
109
111
|
|
110
112
|
gelf_options[:protocol] ||= (@protocol == :tcp ? GELF::Protocol::TCP : GELF::Protocol::UDP)
|
111
113
|
gelf_options[:facility] ||= application
|
@@ -120,11 +122,11 @@ module SemanticLogger
|
|
120
122
|
|
121
123
|
h[:short_message] = h.delete(:message)
|
122
124
|
if h[:short_message].nil?
|
123
|
-
h[:short_message] = log.exception.nil?
|
125
|
+
h[:short_message] = log.exception.nil? ? "<no-exception-message>" : log.exception.message
|
124
126
|
end
|
125
|
-
h[:level]
|
126
|
-
h[:level_str]
|
127
|
-
h[:duration_str]
|
127
|
+
h[:level] = logger.level_map[log.level]
|
128
|
+
h[:level_str] = log.level.to_s
|
129
|
+
h[:duration_str] = h.delete(:duration)
|
128
130
|
h
|
129
131
|
end
|
130
132
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require "honeybadger"
|
3
3
|
rescue LoadError
|
4
|
-
raise LoadError
|
4
|
+
raise LoadError, 'Gem honeybadger is required for logging purposes. Please add the gem "honeybadger" to your Gemfile.'
|
5
5
|
end
|
6
6
|
|
7
7
|
# Send log messages to honeybadger
|
@@ -48,7 +48,7 @@ module SemanticLogger
|
|
48
48
|
context.delete(:exception)
|
49
49
|
::Honeybadger.notify(log.exception, context)
|
50
50
|
else
|
51
|
-
message
|
51
|
+
message = {
|
52
52
|
error_class: context.delete(:name),
|
53
53
|
error_message: context.delete(:message),
|
54
54
|
context: context
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require "net/http"
|
2
|
+
require "uri"
|
3
|
+
require "socket"
|
4
|
+
require "json"
|
5
|
+
require "openssl"
|
6
6
|
|
7
7
|
# Log to any HTTP(S) server that accepts log messages in JSON form
|
8
8
|
#
|
@@ -101,27 +101,29 @@ module SemanticLogger
|
|
101
101
|
@continue_timeout = continue_timeout
|
102
102
|
|
103
103
|
# On Ruby v2.0 and greater, Net::HTTP.new already uses a persistent connection if the server allows it
|
104
|
-
@header
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
104
|
+
@header = {
|
105
|
+
"Accept" => "application/json",
|
106
|
+
"Content-Type" => "application/json",
|
107
|
+
"Connection" => "keep-alive",
|
108
|
+
"Keep-Alive" => "300"
|
109
109
|
}
|
110
|
-
@header[
|
110
|
+
@header["Content-Encoding"] = "gzip" if @compress
|
111
111
|
|
112
112
|
uri = URI.parse(@url)
|
113
113
|
@server = uri.host
|
114
|
-
|
114
|
+
unless @server
|
115
|
+
raise(ArgumentError, "Invalid format for :url: #{@url.inspect}. Should be similar to: 'http://hostname:port/path'")
|
116
|
+
end
|
115
117
|
|
116
118
|
@port = uri.port
|
117
119
|
@username = uri.user if !@username && uri.user
|
118
120
|
@password = uri.password if !@password && uri.password
|
119
121
|
@path = uri.path
|
120
122
|
# Path cannot be empty
|
121
|
-
@path =
|
123
|
+
@path = "/" if @path == ""
|
122
124
|
|
123
|
-
if uri.scheme ==
|
124
|
-
@ssl_options[:use_ssl]
|
125
|
+
if uri.scheme == "https"
|
126
|
+
@ssl_options[:use_ssl] = true
|
125
127
|
@ssl_options[:verify_mode] ||= OpenSSL::SSL::VERIFY_PEER
|
126
128
|
@port ||= HTTP.https_default_port
|
127
129
|
else
|
@@ -205,16 +207,16 @@ module SemanticLogger
|
|
205
207
|
end
|
206
208
|
request.basic_auth(@username, @password) if @username
|
207
209
|
response = @http.request(request)
|
208
|
-
if response.code ==
|
210
|
+
if response.code == "200" || response.code == "201"
|
209
211
|
true
|
210
212
|
else
|
211
213
|
# Failures are logged to the global semantic logger failsafe logger (Usually stderr or file)
|
212
214
|
logger.error("Bad HTTP response from: #{url} code: #{response.code}, #{response.body}")
|
213
215
|
false
|
214
216
|
end
|
215
|
-
rescue RuntimeError =>
|
217
|
+
rescue RuntimeError => e
|
216
218
|
reopen
|
217
|
-
raise
|
219
|
+
raise e
|
218
220
|
end
|
219
221
|
end
|
220
222
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require "kafka"
|
3
3
|
rescue LoadError
|
4
|
-
raise LoadError
|
4
|
+
raise LoadError, 'Gem ruby-kafka is required for logging to Elasticsearch. Please add the gem "ruby-kafka" to your Gemfile.'
|
5
5
|
end
|
6
6
|
|
7
|
-
require
|
7
|
+
require "date"
|
8
8
|
|
9
9
|
# Forward all log messages to Apache Kafka.
|
10
10
|
#
|
@@ -115,9 +115,9 @@ module SemanticLogger
|
|
115
115
|
# metrics: [Boolean]
|
116
116
|
# Send metrics only events to kafka.
|
117
117
|
# Default: true
|
118
|
-
def initialize(seed_brokers:, client_id:
|
118
|
+
def initialize(seed_brokers:, client_id: "semantic-logger", connect_timeout: nil, socket_timeout: nil,
|
119
119
|
ssl_ca_cert: nil, ssl_client_cert: nil, ssl_client_cert_key: nil,
|
120
|
-
topic:
|
120
|
+
topic: "log_messages", partition: nil, partition_key: nil, key: nil,
|
121
121
|
delivery_threshold: 100, delivery_interval: 10,
|
122
122
|
metrics: true, **args, &block)
|
123
123
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require "socket"
|
2
2
|
begin
|
3
|
-
require
|
3
|
+
require "mongo"
|
4
4
|
rescue LoadError
|
5
|
-
raise LoadError
|
5
|
+
raise LoadError, 'Gem mongo is required for logging to MongoDB. Please add the gem "mongo" v2.0 or greater to your Gemfile.'
|
6
6
|
end
|
7
7
|
|
8
8
|
module SemanticLogger
|
@@ -104,9 +104,9 @@ module SemanticLogger
|
|
104
104
|
# Name of this application to appear in log messages.
|
105
105
|
# Default: SemanticLogger.application
|
106
106
|
def initialize(uri:,
|
107
|
-
collection_name:
|
107
|
+
collection_name: "semantic_logger",
|
108
108
|
write_concern: 0,
|
109
|
-
collection_size: 1024
|
109
|
+
collection_size: 1024**3,
|
110
110
|
collection_max: nil,
|
111
111
|
**args,
|
112
112
|
&block)
|
@@ -118,7 +118,7 @@ module SemanticLogger
|
|
118
118
|
size: collection_size,
|
119
119
|
write: {w: write_concern}
|
120
120
|
}
|
121
|
-
@options[:max]
|
121
|
+
@options[:max] = collection_max if collection_max
|
122
122
|
|
123
123
|
reopen
|
124
124
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require "newrelic_rpm"
|
3
3
|
rescue LoadError
|
4
|
-
raise LoadError
|
4
|
+
raise LoadError, 'Gem newrelic_rpm is required for logging to New Relic. Please add the gem "newrelic_rpm" to your Gemfile.'
|
5
5
|
end
|
6
6
|
|
7
7
|
# Send log messages to NewRelic
|
@@ -1,7 +1,7 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require "bunny"
|
3
3
|
rescue LoadError
|
4
|
-
raise LoadError
|
4
|
+
raise LoadError, 'Gem bunny is required for logging to RabbitMQ. Please add the gem "bunny" to your Gemfile.'
|
5
5
|
end
|
6
6
|
|
7
7
|
# Forward all log messages to RabbitMQ.
|
@@ -14,7 +14,7 @@ end
|
|
14
14
|
# # Name of the queue in RabbitMQ where to publish the logs. This queue will be bound to "amqp.direct" exchange.
|
15
15
|
# queue: 'semantic_logger',
|
16
16
|
#
|
17
|
-
# # This host will be used for RabbitMQ connection.
|
17
|
+
# # This host will be used for RabbitMQ connection.
|
18
18
|
# # NOTE this is different than :host option which is used by the logger directly.
|
19
19
|
# rabbitmq_host: '127.0.0.1',
|
20
20
|
#
|
@@ -63,7 +63,7 @@ module SemanticLogger
|
|
63
63
|
# RabbitMQ Parameters:
|
64
64
|
#
|
65
65
|
# rabbitmq_host: [String]
|
66
|
-
# Host for AMQP connection. in Bunny this is called :host but here it has
|
66
|
+
# Host for AMQP connection. in Bunny this is called :host but here it has
|
67
67
|
# been remapped to avoid conflicting with SemanticLogger's :host param.
|
68
68
|
# Default: localhost
|
69
69
|
#
|
@@ -76,7 +76,7 @@ module SemanticLogger
|
|
76
76
|
# Default: nil
|
77
77
|
#
|
78
78
|
# more parameters supported by Bunny: http://rubybunny.info/articles/connecting.html
|
79
|
-
def initialize(queue_name:
|
79
|
+
def initialize(queue_name: "semantic_logger", rabbitmq_host: nil, metrics: false, **args, &block)
|
80
80
|
@queue_name = queue_name
|
81
81
|
@rabbitmq_args = args.dup
|
82
82
|
@rabbitmq_args[:host] = rabbitmq_host
|
@@ -1,7 +1,7 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require "sentry-raven"
|
3
3
|
rescue LoadError
|
4
|
-
raise LoadError
|
4
|
+
raise LoadError, 'Gem sentry-raven is required for logging purposes. Please add the gem "sentry-raven" to your Gemfile.'
|
5
5
|
end
|
6
6
|
|
7
7
|
# Send log messages to sentry
|
@@ -46,12 +46,12 @@ module SemanticLogger
|
|
46
46
|
# Send an error notification to sentry
|
47
47
|
def log(log)
|
48
48
|
# Ignore logs coming from Raven itself
|
49
|
-
return false if log.name ==
|
49
|
+
return false if log.name == "Raven"
|
50
50
|
|
51
|
-
context
|
52
|
-
user
|
53
|
-
tags
|
54
|
-
attrs
|
51
|
+
context = formatter.call(log, self)
|
52
|
+
user = context.delete(:user)
|
53
|
+
tags = context.delete(:tags)
|
54
|
+
attrs = {
|
55
55
|
level: context.delete(:level),
|
56
56
|
extra: context
|
57
57
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require "splunk-sdk-ruby"
|
3
3
|
rescue LoadError
|
4
|
-
raise LoadError
|
4
|
+
raise LoadError, 'Gem splunk-sdk-ruby is required for logging to Splunk. Please add the gem "splunk-sdk-ruby" to your Gemfile.'
|
5
5
|
end
|
6
6
|
|
7
7
|
# Splunk log appender.
|
@@ -88,7 +88,7 @@ module SemanticLogger
|
|
88
88
|
# regular expression. All other messages will be ignored.
|
89
89
|
# Proc: Only include log messages where the supplied Proc returns true
|
90
90
|
# The Proc must return true or false.
|
91
|
-
def initialize(index:
|
91
|
+
def initialize(index: "main", source_type: nil, **args, &block)
|
92
92
|
@index = index
|
93
93
|
@source_type = source_type
|
94
94
|
|
@@ -120,7 +120,7 @@ module SemanticLogger
|
|
120
120
|
def call(log, logger)
|
121
121
|
h = SemanticLogger::Formatters::Raw.new.call(log, logger)
|
122
122
|
h.delete(:time)
|
123
|
-
message
|
123
|
+
message = {
|
124
124
|
source: logger.application,
|
125
125
|
host: logger.host,
|
126
126
|
time: log.time.utc.to_f,
|
@@ -128,7 +128,7 @@ module SemanticLogger
|
|
128
128
|
event: h
|
129
129
|
}
|
130
130
|
message[:environment] = logger.environment if logger.environment
|
131
|
-
message[:sourcetype]
|
131
|
+
message[:sourcetype] = source_type if source_type
|
132
132
|
message
|
133
133
|
end
|
134
134
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "json"
|
2
2
|
# Splunk log appender using the Splunk HTTP(S) listener.
|
3
3
|
#
|
4
4
|
# Use the newer, faster and more complete JSON over HTTP interface for Splunk.
|
@@ -81,22 +81,22 @@ module SemanticLogger
|
|
81
81
|
super(compress: compress, **args, &block)
|
82
82
|
|
83
83
|
# Put splunk auth token in the header of every HTTP post.
|
84
|
-
@header[
|
84
|
+
@header["Authorization"] = "Splunk #{token}"
|
85
85
|
end
|
86
86
|
|
87
87
|
# Returns [String] JSON to send to Splunk.
|
88
88
|
#
|
89
89
|
# For splunk format requirements see:
|
90
|
-
#
|
90
|
+
# https://docs.splunk.com/Documentation/Splunk/latest/Data/FormateventsforHTTPEventCollector
|
91
91
|
def call(log, logger)
|
92
92
|
h = SemanticLogger::Formatters::Raw.new(time_format: :seconds).call(log, logger)
|
93
|
+
h.delete(:host)
|
93
94
|
message = {
|
94
95
|
source: logger.application,
|
95
96
|
host: logger.host,
|
96
97
|
time: h.delete(:time),
|
97
98
|
event: h
|
98
99
|
}
|
99
|
-
message[:environment] = logger.environment if logger.environment
|
100
100
|
message[:sourcetype] = source_type if source_type
|
101
101
|
message[:index] = index if index
|
102
102
|
message.to_json
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "syslog"
|
2
|
+
require "uri"
|
3
|
+
require "socket"
|
4
4
|
# Send log messages to local syslog, or remote syslog servers over TCP or UDP.
|
5
5
|
#
|
6
6
|
# Example:
|
@@ -31,7 +31,7 @@ require 'socket'
|
|
31
31
|
module SemanticLogger
|
32
32
|
module Appender
|
33
33
|
class Syslog < SemanticLogger::Subscriber
|
34
|
-
attr_reader :remote_syslog, :url, :server, :port, :protocol, :facility, :options, :level_map
|
34
|
+
attr_reader :remote_syslog, :url, :server, :port, :protocol, :facility, :options, :level_map, :max_size
|
35
35
|
|
36
36
|
# Create a Syslog appender instance.
|
37
37
|
#
|
@@ -73,6 +73,10 @@ module SemanticLogger
|
|
73
73
|
# Identity of the program.
|
74
74
|
# Default: SemanticLogger.application
|
75
75
|
#
|
76
|
+
# max_size: [Integer]
|
77
|
+
# Set your own packet size.
|
78
|
+
# Default: 1024 bytes
|
79
|
+
#
|
76
80
|
# options: [Integer]
|
77
81
|
# Default: ::Syslog::LOG_PID | ::Syslog::LOG_CONS
|
78
82
|
# Any of the following (options can be logically OR'd together)
|
@@ -119,8 +123,9 @@ module SemanticLogger
|
|
119
123
|
# Example:
|
120
124
|
# # Change the warn level to LOG_NOTICE level instead of a the default of LOG_WARNING.
|
121
125
|
# SemanticLogger.add_appender(appender: :syslog, level_map: {warn: ::Syslog::LOG_NOTICE})
|
122
|
-
def initialize(url:
|
126
|
+
def initialize(url: "syslog://localhost",
|
123
127
|
facility: ::Syslog::LOG_USER,
|
128
|
+
max_size: 1024,
|
124
129
|
level_map: SemanticLogger::Formatters::Syslog::LevelMap.new,
|
125
130
|
options: ::Syslog::LOG_PID | ::Syslog::LOG_CONS,
|
126
131
|
tcp_client: {},
|
@@ -129,13 +134,14 @@ module SemanticLogger
|
|
129
134
|
|
130
135
|
@options = options
|
131
136
|
@facility = facility
|
137
|
+
@max_size = max_size
|
132
138
|
@level_map = level_map
|
133
139
|
@url = url
|
134
140
|
uri = URI(@url)
|
135
|
-
@server = uri.host ||
|
141
|
+
@server = uri.host || "localhost"
|
136
142
|
@protocol = (uri.scheme || :syslog).to_sym
|
137
143
|
@port = uri.port || 514
|
138
|
-
@server =
|
144
|
+
@server = "localhost" if @protocol == :syslog
|
139
145
|
@tcp_client_options = tcp_client
|
140
146
|
|
141
147
|
raise "Unknown protocol #{@protocol}!" unless %i[syslog tcp udp].include?(@protocol)
|
@@ -143,17 +149,17 @@ module SemanticLogger
|
|
143
149
|
# The syslog_protocol gem is required when logging over TCP or UDP.
|
144
150
|
if %i[tcp udp].include?(@protocol)
|
145
151
|
begin
|
146
|
-
require
|
152
|
+
require "syslog_protocol"
|
147
153
|
rescue LoadError
|
148
|
-
raise LoadError
|
154
|
+
raise LoadError, "Missing gem: syslog_protocol. This gem is required when logging over TCP or UDP. To fix this error: gem install syslog_protocol"
|
149
155
|
end
|
150
156
|
|
151
157
|
# The net_tcp_client gem is required when logging over TCP.
|
152
158
|
if protocol == :tcp
|
153
159
|
begin
|
154
|
-
require
|
160
|
+
require "net/tcp_client"
|
155
161
|
rescue LoadError
|
156
|
-
raise LoadError
|
162
|
+
raise LoadError, "Missing gem: net_tcp_client. This gem is required when logging over TCP. To fix this error: gem install net_tcp_client"
|
157
163
|
end
|
158
164
|
end
|
159
165
|
end
|
@@ -171,7 +177,7 @@ module SemanticLogger
|
|
171
177
|
::Syslog.send(method, application, options, facility)
|
172
178
|
when :tcp
|
173
179
|
@tcp_client_options[:server] = "#{@server}:#{@port}"
|
174
|
-
@remote_syslog = Net::TCPClient.new(
|
180
|
+
@remote_syslog = Net::TCPClient.new(**@tcp_client_options)
|
175
181
|
# Use the local logger for @remote_syslog so errors with the remote logger can be recorded locally.
|
176
182
|
@remote_syslog.logger = logger
|
177
183
|
when :udp
|
@@ -186,7 +192,7 @@ module SemanticLogger
|
|
186
192
|
case @protocol
|
187
193
|
when :syslog
|
188
194
|
# Since the Ruby Syslog API supports sprintf format strings, double up all existing '%'
|
189
|
-
message = formatter.call(log, self).gsub
|
195
|
+
message = formatter.call(log, self).gsub "%", "%%"
|
190
196
|
::Syslog.log @level_map[log.level], message
|
191
197
|
when :tcp
|
192
198
|
@remote_syslog.retry_on_connection_failure { @remote_syslog.write("#{formatter.call(log, self)}\r\n") }
|
@@ -209,7 +215,7 @@ module SemanticLogger
|
|
209
215
|
# Format is text output without the time
|
210
216
|
SemanticLogger::Formatters::Default.new(time_format: nil)
|
211
217
|
else
|
212
|
-
SemanticLogger::Formatters::Syslog.new(facility: facility, level_map: level_map)
|
218
|
+
SemanticLogger::Formatters::Syslog.new(facility: facility, level_map: level_map, max_size: max_size)
|
213
219
|
end
|
214
220
|
end
|
215
221
|
end
|