lib/logsly.rb in logsly-1.2.0 vs lib/logsly.rb in logsly-1.3.0
- old
+ new
@@ -1,8 +1,8 @@
require 'much-plugin'
-require 'logging'
require 'logsly/version'
+require 'logsly/logging182'
require 'logsly/colors'
require 'logsly/outputs'
module Logsly
include MuchPlugin
@@ -12,11 +12,11 @@
end
def self.reset
@settings = nil
- Logging.reset
+ Logsly::Logging182.reset
end
def self.settings
@settings ||= Settings.new
end
@@ -49,23 +49,23 @@
def initialize(log_type, opts = nil)
opts ||= {}
@log_type = log_type.to_s
@level = (opts[:level] || opts['level'] || 'info').to_s
- @outputs = opts[:outputs] || opts['outputs'] || []
+ @outputs = [*(opts[:outputs] || opts['outputs'] || [])]
unique_name = "#{self.class.name}-#{@log_type}-#{self.object_id}"
- @logger = Logging.logger[unique_name]
+ @logger = Logsly::Logging182.logger[unique_name]
@logger.level = @level
@outputs.each do |output|
add_appender(Logsly.outputs(output).to_appender(self))
end
end
def mdc(key, value)
- Logging.mdc[key] = value
+ Logsly::Logging182.mdc[key] = value
end
def file_path
@file_path ||= if (appender = get_file_appender)
appender.name if appender.respond_to?(:name)
@@ -106,10 +106,10 @@
existing.kind_of?(appender.class) && existing.name == appender.name
end
end
def get_file_appender
- @logger.appenders.detect{ |a| a.kind_of?(Logging::Appenders::File) }
+ @logger.appenders.detect{ |a| a.kind_of?(Logsly::Logging182::Appenders::File) }
end
end
class Settings