Module: BbDeploy::Logger

Included in:
Deployer
Defined in:
lib/bb_deploy/logger.rb

Overview

Helper file for Logging/Slack notifications

Defined Under Namespace

Modules: ConsolidatedLogger

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.logger(phase) ⇒ Object



3
4
5
# File 'lib/bb_deploy/logger.rb', line 3

def self.logger(phase)
  @logger ||= ConsolidatedLogger::Logentries.new(phase) # Phase-specific memoization
end

Instance Method Details

#chat_broadcast(msg, phase:, notify_eng_hub: false) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# 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

#slackObject



65
66
67
# File 'lib/bb_deploy/logger.rb', line 65

def slack
  @slack ||= Slack::Notifier.new(BbDeploy::Config.slack_webhook_key)
end