From a7550105ab9fdc53477356da44126850bedebcfc Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Mon, 1 Jun 2020 09:19:22 +1000 Subject: [PATCH] feat: allow Pactflow messages in logs to be hidden by setting PACT_BROKER_HIDE_PACTFLOW_MESSAGES=true --- lib/pact_broker/app.rb | 4 +++- lib/pact_broker/logging.rb | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/pact_broker/app.rb b/lib/pact_broker/app.rb index 32eaae3bb..fe7f948ea 100644 --- a/lib/pact_broker/app.rb +++ b/lib/pact_broker/app.rb @@ -232,7 +232,9 @@ def running_app end def print_startup_message - logger.info "\n\n#{'*' * 80}\n\nWant someone to manage your Pact Broker for you? Check out https://pactflow.io/oss for a hardened, fully supported SaaS version of the Pact Broker with an improved UI + more.\n\n#{'*' * 80}\n" + if ENV['PACT_BROKER_HIDE_PACTFLOW_MESSAGES'] != 'true' + logger.info "\n\n#{'*' * 80}\n\nWant someone to manage your Pact Broker for you? Check out https://pactflow.io/oss for a hardened, fully supported SaaS version of the Pact Broker with an improved UI + more.\n\n#{'*' * 80}\n" + end end end end diff --git a/lib/pact_broker/logging.rb b/lib/pact_broker/logging.rb index cd7a3eb12..fca8e56ce 100644 --- a/lib/pact_broker/logging.rb +++ b/lib/pact_broker/logging.rb @@ -34,7 +34,9 @@ def log_error e, description = nil message = "#{e.class} #{e.message}\n#{e.backtrace.join("\n")}" message = "#{description} - #{message}" if description logger.error message - logger.info "\n\n#{'*' * 80}\n\nPrefer it was someone else's job to deal with this error? Check out https://pactflow.io/oss for a hardened, fully supported SaaS version of the Pact Broker with an improved UI + more.\n\n#{'*' * 80}\n" + if ENV['PACT_BROKER_HIDE_PACTFLOW_MESSAGES'] != 'true' + logger.info "\n\n#{'*' * 80}\n\nPrefer it was someone else's job to deal with this error? Check out https://pactflow.io/oss for a hardened, fully supported SaaS version of the Pact Broker with an improved UI + more.\n\n#{'*' * 80}\n" + end end end