Module: LogStashLogger
- Defined in:
- lib/logstash-logger/multi_logger.rb,
lib/logstash-logger/device.rb,
lib/logstash-logger/logger.rb,
lib/logstash-logger/railtie.rb,
lib/logstash-logger/version.rb,
lib/logstash-logger/device/io.rb,
lib/logstash-logger/formatter.rb,
lib/logstash-logger/device/tcp.rb,
lib/logstash-logger/device/udp.rb,
lib/logstash-logger/device/base.rb,
lib/logstash-logger/device/file.rb,
lib/logstash-logger/device/unix.rb,
lib/logstash-logger/device/kafka.rb,
lib/logstash-logger/device/redis.rb,
lib/logstash-logger/configuration.rb,
lib/logstash-logger/device/socket.rb,
lib/logstash-logger/device/stderr.rb,
lib/logstash-logger/device/stdout.rb,
lib/logstash-logger/formatter/cee.rb,
lib/logstash-logger/formatter/base.rb,
lib/logstash-logger/formatter/json.rb,
lib/logstash-logger/tagged_logging.rb,
lib/logstash-logger/device/balancer.rb,
lib/logstash-logger/device/connectable.rb,
lib/logstash-logger/formatter/cee_syslog.rb,
lib/logstash-logger/formatter/json_lines.rb,
lib/logstash-logger/device/multi_delegator.rb,
lib/logstash-logger/formatter/logstash_event.rb
Overview
Defined Under Namespace
Modules: Device, Formatter, TaggedLogging
Classes: Configuration, MultiLogger, Railtie
Constant Summary
collapse
- VERSION =
"0.14.1"
Class Method Summary
collapse
Class Method Details
3
4
5
6
|
# File 'lib/logstash-logger/configuration.rb', line 3
def configure(&block)
@configuration = Configuration.new(&block) if block_given? || @configuration.nil?
@configuration
end
|
.extended(base) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/logstash-logger/logger.rb', line 17
def self.extended(base)
base.instance_eval do
class << self
attr_reader :device
end
def flush
!!(@device.flush if @device.respond_to?(:flush))
end
end
end
|
.new(*args) ⇒ Object
12
13
14
15
|
# File 'lib/logstash-logger/logger.rb', line 12
def self.new(*args)
opts = (*args)
build_logger(opts)
end
|
.sanitize_logger_options(app, logger_options) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/logstash-logger/railtie.rb', line 24
def self.sanitize_logger_options(app, logger_options)
logger_options = ActiveSupport::OrderedOptions.new.merge(logger_options)
if parsed_uri_options = LogStashLogger::Device.parse_uri_config(logger_options)
logger_options.delete(:uri)
logger_options.merge!(parsed_uri_options)
end
if logger_options.type == :file
logger_options.path ||= app.config.paths["log"].first
end
if app.config.respond_to?(:autoflush_log)
logger_options.sync = app.config.autoflush_log
end
logger_options
end
|
.setup(app) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/logstash-logger/railtie.rb', line 4
def self.setup(app)
return unless app.config.logstash.present?
logger_options = app.config.logstash
sanitized_logger_options = if logger_options.is_a?(Array)
logger_options.map do |opts|
sanitize_logger_options(app, opts)
end
else
sanitize_logger_options(app, logger_options)
end
logger = LogStashLogger.new(sanitized_logger_options)
logger.level = ::Logger.const_get(app.config.log_level.to_s.upcase)
app.config.logger = logger
end
|