module BbDeploy::Logger

Helper file for Logging/Slack notifications

Public Class Methods

logger(phase) click to toggle source
# File lib/bb_deploy/logger.rb, line 3
def self.logger(phase)
  @logger ||= ConsolidatedLogger::Logentries.new(phase) # Phase-specific memoization
end

Public Instance Methods

chat_broadcast(msg, phase:, notify_eng_hub: false) click to toggle source
# File lib/bb_deploy/logger.rb, line 44
def chat_broadcast(msg, phase:, notify_eng_hub: false)
  attachment = [
    {
      fallback: "Deploying to #{phase}",
      color: " ",
      fields: [
        {
          title: "Details",
          value: msg,
          short: false
        }
      ]
    }
  ]

  slack.ping("*Deploying to #{phase}*", attachments: attachment, channel: BbDeploy::Config.deployment_channel)
  slack.ping("*Deploying to #{phase}*", attachments: attachment, channel: BbDeploy::Config.engineering_channel) if notify_eng_hub
  @consolidated_logger ||= ConsolidatedLogger::Logentries.new(phase)
  @consolidated_logger.logger.info("DEPLOY--#{msg}")
end
slack() click to toggle source
# File lib/bb_deploy/logger.rb, line 65
def slack
  @slack ||= Slack::Notifier.new(BbDeploy::Config.slack_webhook_key)
end