Skip to content

Commit

Permalink
update log level to warn for default and make logging level configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Runner committed Aug 15, 2023
1 parent 62b5818 commit 9cb5464
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/event_source/configure/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Config

# 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|
Expand Down Expand Up @@ -164,8 +165,6 @@ def delimiter(protocol)
'.'
end
end

attr_accessor :app_name
end
end
end
2 changes: 1 addition & 1 deletion lib/event_source/logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
1 change: 1 addition & 0 deletions spec/config_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

EventSource.configure do |config|
config.protocols = %w[amqp http]
config.log_level = :warn
end

EventSource.initialize!
1 change: 1 addition & 0 deletions spec/event_source/logging_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require 'config_helper'
require 'event_source/logging'

class LogService
Expand Down
1 change: 1 addition & 0 deletions spec/rails_app/config/initializers/event_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9cb5464

Please sign in to comment.