Class: Ruboclean::Logger

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

Overview

Logger for clean management of log levels

Instance Method Summary collapse

Constructor Details

#initialize(log_level = :verbose) ⇒ Logger

Returns a new instance of Logger.

Raises:

  • (ArgumentError)


6
7
8
9
10
# File 'lib/ruboclean/logger.rb', line 6

def initialize(log_level = :verbose)
  raise ArgumentError, "Invalid log level" unless %i[verbose none].include?(log_level)

  @log_level = log_level
end

Instance Method Details

#verbose(message) ⇒ Object



12
13
14
15
16
17
# File 'lib/ruboclean/logger.rb', line 12

def verbose(message)
  case @log_level
  when :verbose
    print message
  end
end