Class: Henry::Logger

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

Overview

Henry Logger Grants the ability log messages under several levels during execution time

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#storage(level) ⇒ Array

Returns the storage of the given level

Parameters:

  • level (Symbol)

    the target log level.

Returns:

  • (Array)

    the logs collection of the given level.



46
47
48
# File 'lib/henry/logger.rb', line 46

def storage
  @storage
end

Instance Method Details

#error(message) ⇒ Object

Appends the message as a log entry under the error level.

Parameters:

  • message (String)

    the message to be appended.



26
27
28
# File 'lib/henry/logger.rb', line 26

def error(message)
  self.log(:error, message)
end

#get_storageHash

Returns the storage

Returns:

  • (Hash)

    the storage.



38
39
40
# File 'lib/henry/logger.rb', line 38

def get_storage
  @storage ||= {}
end

#info(message) ⇒ Object

Appends the message as a log entry under the info level.

Parameters:

  • message (String)

    the message to be appended.



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

def info(message)
  self.log(:info, message)
end

#log_as_hashObject

Return the stored logs.



31
32
33
# File 'lib/henry/logger.rb', line 31

def log_as_hash
  self.get_storage
end

#warn(message) ⇒ Object

Appends the message as a log entry under the warm level.

Parameters:

  • message (String)

    the message to be appended.



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

def warn(message)
  self.log(:warn, message)
end