Class: Ghaki::Logger::Wrapper::Major

Inherits:
Base
  • Object
show all
Defined in:
lib/ghaki/logger/wrapper/major.rb

Overview

Major mode for info logging.

Instance Attribute Summary collapse

Attributes inherited from Base

#logger

Instance Method Summary collapse

Methods inherited from Base

#wrap, #wrap!, #wrap_if, #wrap_if!

Constructor Details

#initialize(opts = {}) ⇒ Major

Constructor options:

box_char

Character used to make line separators in the logs.

box_size

Line length used for separators in the logs.



23
24
25
26
# File 'lib/ghaki/logger/wrapper/major.rb', line 23

def initialize opts={} ; super opts
  @box_char = opts[:box_char] || MAJOR_BOX_CHAR
  @box_size = opts[:box_size] || DEF_BOX_SIZE
end

Instance Attribute Details

#box_charObject

Accessors for dealing with the line creation.



12
13
14
# File 'lib/ghaki/logger/wrapper/major.rb', line 12

def box_char
  @box_char
end

#box_sizeObject

Accessors for dealing with the line creation.



12
13
14
# File 'lib/ghaki/logger/wrapper/major.rb', line 12

def box_size
  @box_size
end

Instance Method Details

#began(msg, box_char = @box_char, box_size = @box_size) ⇒ Object

Log that the major process began.



30
31
32
33
34
# File 'lib/ghaki/logger/wrapper/major.rb', line 30

def began msg, box_char=@box_char, box_size=@box_size
  logger.liner box_char, box_size
  logger.info 'BEGAN ' + msg
  logger.liner box_char, box_size
end

#ended(msg, box_char = @box_char, box_size = @box_size) ⇒ Object

Log that the major process ended.



38
39
40
41
42
# File 'lib/ghaki/logger/wrapper/major.rb', line 38

def ended msg, box_char=@box_char, box_size=@box_size
  logger.liner box_char, box_size
  logger.info 'ENDED ' + msg
  logger.liner box_char, box_size
end

#step(msg) ⇒ Object

Log the major proecss step.



46
47
48
# File 'lib/ghaki/logger/wrapper/major.rb', line 46

def step msg
  logger.info 'STEP ' + msg
end