diff --git a/lib/event_source/configure/config.rb b/lib/event_source/configure/config.rb index 33ffe46..5c4423c 100644 --- a/lib/event_source/configure/config.rb +++ b/lib/event_source/configure/config.rb @@ -8,8 +8,13 @@ module Configure class Config include EventSource::Logging + def initialize + @log_level = :warn + end + # TODO: add default for pub_sub_root attr_writer :pub_sub_root, :protocols, :server_configurations + attr_accessor :app_name, :log_level def load_protocols @protocols.each do |protocol| @@ -164,8 +169,6 @@ def delimiter(protocol) '.' end end - - attr_accessor :app_name end end end diff --git a/lib/event_source/logging.rb b/lib/event_source/logging.rb index 5a0b38b..0fdb0db 100644 --- a/lib/event_source/logging.rb +++ b/lib/event_source/logging.rb @@ -24,7 +24,7 @@ def logger ::Logging.appenders.rolling_file( 'log/event_source.log', age: 'daily', - level: :debug, + level: EventSource.config.log_level, keep: 7, layout: ::Logging.layouts.json ) diff --git a/spec/config_helper.rb b/spec/config_helper.rb index ff3ea25..d3d1165 100644 --- a/spec/config_helper.rb +++ b/spec/config_helper.rb @@ -2,6 +2,7 @@ EventSource.configure do |config| config.protocols = %w[amqp http] + config.log_level = :warn end EventSource.initialize! diff --git a/spec/event_source/logging_spec.rb b/spec/event_source/logging_spec.rb index ee947e1..e2fc0aa 100644 --- a/spec/event_source/logging_spec.rb +++ b/spec/event_source/logging_spec.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'config_helper' require 'event_source/logging' class LogService diff --git a/spec/rails_app/config/initializers/event_source.rb b/spec/rails_app/config/initializers/event_source.rb index 20e0440..384187c 100644 --- a/spec/rails_app/config/initializers/event_source.rb +++ b/spec/rails_app/config/initializers/event_source.rb @@ -5,6 +5,7 @@ config.pub_sub_root = Pathname.pwd.join('spec', 'rails_app', 'app', 'event_source') config.server_key = Rails.env.to_sym config.app_name = :enroll + config.log_level = :warn config.servers do |server| # mitc