Module: LoggerEasy

Defined in:
lib/logger_easy.rb,
lib/logger_easy/version.rb

Overview

below is the code to make life easier as it already has logging methods defined

Constant Summary collapse

VERSION =
'0.2.0'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#log_file_nameObject

Returns the value of attribute log_file_name.



8
9
10
# File 'lib/logger_easy.rb', line 8

def log_file_name
  @log_file_name
end

Instance Method Details

#initialize(log_file_name = 'logger_easy.log') ⇒ Object



10
11
12
13
# File 'lib/logger_easy.rb', line 10

def initialize(log_file_name = 'logger_easy.log')
  @log_file_name = log_file_name
  @logger = Logger.new(log_file_name)
end

#log_debug(message) ⇒ Object



20
21
22
23
# File 'lib/logger_easy.rb', line 20

def log_debug(message)
  @logger ||= Logger.new(@log_file_name)
  @logger.debug(message)
end

#log_error(message) ⇒ Object



25
26
27
28
# File 'lib/logger_easy.rb', line 25

def log_error(message)
  @logger ||= Logger.new(@log_file_name)
  @logger.error(message)
end

#log_info(message) ⇒ Object



15
16
17
18
# File 'lib/logger_easy.rb', line 15

def log_info(message)
  @logger ||= Logger.new(@log_file_name)
  @logger.info(message)
end