Skip to content

Commit

Permalink
feat(semantic-logging): set logger for SuckerPunch and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Oct 4, 2018
1 parent cfbb704 commit 201eb33
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/pact_broker/app.rb
@@ -1,7 +1,7 @@
require 'pact_broker/configuration'
require 'pact_broker/db'
require 'pact_broker/project_root'
require 'pact_broker/default_formatter'
require 'pact_broker/logging/default_formatter'
require 'rack-protection'
require 'rack/hal_browser'
require 'rack/pact_broker/store_base_url'
Expand Down Expand Up @@ -62,7 +62,7 @@ def call env

def post_configure
configure_logger
SuckerPunch.logger = SemanticLogger['SuckerPunch']
SuckerPunch.logger = configuration.custom_logger || SemanticLogger['SuckerPunch']
configure_database_connection
configure_sucker_punch
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/configuration.rb
Expand Up @@ -51,7 +51,7 @@ def initialize
@authenticate_with_basic_auth = nil
@authorize = nil
@api_error_reporters = []
@semantic_logger = SemanticLogger[Configuration]
@semantic_logger = SemanticLogger["root"]
end

def self.default_configuration
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Expand Up @@ -6,6 +6,10 @@

$: << File.expand_path("../../", __FILE__)

require 'semantic_logger'
require 'pact_broker/logging/default_formatter'
SemanticLogger.add_appender(file_name: "log/test.log", formatter: PactBroker::Logging::DefaultFormatter.new)

require 'db'
require 'tasks/database'
require 'pact_broker/db'
Expand Down

0 comments on commit 201eb33

Please sign in to comment.