Sha256: b52e388a8e37775921a541c30ff15b38a69762c6041a132336c451dcb07bfc22

Contents?: true

Size: 691 Bytes

Versions: 2

Compression:

Stored size: 691 Bytes

Contents

# frozen_string_literal: true

require('slack-ruby-client')
require('console_tracker/loggers/slack/compose_message')

module ConsoleTracker
  module Loggers
    class SlackLogger
      attr_reader :logger_settings

      def initialize
        @logger_settings = ConsoleTracker.config.logger_settings
      end

      def message_composer
        ConsoleTracker::Slack::ComposeMessage
      end

      def log_command(message_params)
        message_params[:channel] = logger_settings[:channel]
        client.chat_postMessage(message_params)
      end

      private

      def client
        @client ||= ::Slack::Web::Client.new(token: logger_settings[:token])
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
console_tracker-0.0.0.pre.beta3 lib/console_tracker/loggers/slack.rb
console_tracker-0.0.0.pre.beta2 lib/console_tracker/loggers/slack.rb