Class: Really::Logger

Inherits:
Object show all
Defined in:
lib/really/logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



5
6
7
8
9
# File 'lib/really/logger.rb', line 5

def initialize
  $stdout.sync = true
  @verbose = false
  @quiet = false
end

Instance Attribute Details

#quietObject

Returns the value of attribute quiet.



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

def quiet
  @quiet
end

#verboseObject

Returns the value of attribute verbose.



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

def verbose
  @verbose
end

Instance Method Details

#debug(message, options = {}) ⇒ Object



27
28
29
30
31
# File 'lib/really/logger.rb', line 27

def debug(message, options = {})
  default_options = { header: 'debug:', header_color: :pink }
  options = default_options.merge options
  log message, options if @verbose
end

#error(message, options = {}) ⇒ Object



15
16
17
18
19
# File 'lib/really/logger.rb', line 15

def error(message, options = {})
  default_options = { header: 'error:', header_color: :red, override_quiet: true }
  options = default_options.merge options
  log message, options
end

#status(message, options = {}) ⇒ Object



11
12
13
# File 'lib/really/logger.rb', line 11

def status(message, options = {})
  log message, options
end

#warning(message, options = {}) ⇒ Object



21
22
23
24
25
# File 'lib/really/logger.rb', line 21

def warning(message, options = {})
  default_options = { header: 'warning:', header_color: :yellow }
  options = default_options.merge options
  log message, options
end