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



6
7
8
# File 'lib/bb_deploy/logger.rb', line 6

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



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/bb_deploy/logger.rb', line 47

def chat_broadcast(msg, phase:, notify_eng_hub: false)
  attachment = [
    {
      fallback: "Deploying to #{phase}",
      color: "good",
      fields: [
        {
          title: "Details",
          # Work the cuteness back in at some point ...
          value: msg.gsub("(successful)", ":rocket:"), # .gsub("(hisham)", ":hisham:").gsub("(jusx)", ":jusx:")
          short: false
        }
      ]
    }
  ]

  puts "[ *Deploying to #{phase}* ]"
  # 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



70
71
72
# File 'lib/bb_deploy/logger.rb', line 70

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