Class: SlackBot::DevConsole

Inherits:
Object
  • Object
show all
Defined in:
lib/slack_bot/dev_console.rb

Class Method Summary collapse

Class Method Details

.enabled=(value) ⇒ Object



3
4
5
# File 'lib/slack_bot/dev_console.rb', line 3

def self.enabled=(value)
  @enabled = value
end

.enabled?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/slack_bot/dev_console.rb', line 7

def self.enabled?
  @enabled
end

.log(message = nil, &block) ⇒ Object



19
20
21
22
23
24
# File 'lib/slack_bot/dev_console.rb', line 19

def self.log(message = nil, &block)
  return unless enabled?

  message = yield if block
  logger.info(message)
end

.log_check(message = nil, &block) ⇒ Object



36
37
38
39
# File 'lib/slack_bot/dev_console.rb', line 36

def self.log_check(message = nil, &block)
  message = yield if block
  log("!!! #{message}")
end

.log_input(message = nil, &block) ⇒ Object



26
27
28
29
# File 'lib/slack_bot/dev_console.rb', line 26

def self.log_input(message = nil, &block)
  message = yield if block
  log(">>> #{message}")
end

.log_output(message = nil, &block) ⇒ Object



31
32
33
34
# File 'lib/slack_bot/dev_console.rb', line 31

def self.log_output(message = nil, &block)
  message = yield if block
  log("<<< #{message}")
end

.loggerObject



15
16
17
# File 'lib/slack_bot/dev_console.rb', line 15

def self.logger
  @logger ||= Logger.new
end

.logger=(value) ⇒ Object



11
12
13
# File 'lib/slack_bot/dev_console.rb', line 11

def self.logger=(value)
  @logger = value
end