lib/legion/logging/logger.rb in legion-logging-0.2.0 vs lib/legion/logging/logger.rb in legion-logging-0.3.1

- old
+ new

@@ -2,22 +2,19 @@ require 'legion/logging/builder' module Legion module Logging class Logger - attr_accessor :log, :color, :level, :lex, :log_file, :trace_enabled, :extended + attr_reader :log, :color include Legion::Logging::Methods include Legion::Logging::Builder - def initialize(level: 'info', log_file: nil, lex: nil, trace: false, extended: false, trace_size: 4, **opts) # rubocop:disable Metrics/ParameterLists - output(logfile: log_file) - log_level(level) - log_format(lex: lex, extended: extended, **opts) - @color = opts[:color] - @color = true if opts[:color].nil? && log_file.nil? - @trace_enabled = trace - @trace_size = trace_size - @extended = extended + def initialize(options = {}) + output(options) + log_level(options[:level]) + log_format(options) + @color = options[:color] + @color = true if options[:color].nil? && options[:log_file].nil? end end end end