Class: Happo::Logger

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

Overview

Used for all CLI output

Instance Method Summary collapse

Constructor Details

#initialize(out = STDOUT) ⇒ Logger

Returns a new instance of Logger.

Parameters:

  • out (IO) (defaults to: STDOUT)

    the output destination



5
6
7
# File 'lib/happo/logger.rb', line 5

def initialize(out = STDOUT)
  @out = out
end

Instance Method Details

#cyan(str) ⇒ Object

Mark the string in cyan

Parameters:

  • str (String)

    the str to format



19
20
21
# File 'lib/happo/logger.rb', line 19

def cyan(str)
  color(36, str)
end

#log(str, newline = true) ⇒ Object

Print the specified output

Parameters:

  • str (String)

    the output to send

  • newline (Boolean) (defaults to: true)

    whether to append a newline



12
13
14
15
# File 'lib/happo/logger.rb', line 12

def log(str, newline = true)
  @out.print(str)
  @out.print("\n") if newline
end