Class: Awsom::CustomLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/awsom/custom_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ CustomLogger

Returns a new instance of CustomLogger.



7
8
9
10
# File 'lib/awsom/custom_logger.rb', line 7

def initialize(file)
  super(file)
  @level = ::Logger::INFO
end

Instance Attribute Details

#trace=(value) ⇒ Object (writeonly)

Sets the attribute trace

Parameters:

  • value

    the value to set the attribute trace to.



5
6
7
# File 'lib/awsom/custom_logger.rb', line 5

def trace=(value)
  @trace = value
end

Instance Method Details

#bullet(msg) ⇒ Object



25
26
27
# File 'lib/awsom/custom_logger.rb', line 25

def bullet(msg)
  puts "#{"\u2219".bold.blue} #{msg}"
end

#format_message(severity, timestamp, progname, msg) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/awsom/custom_logger.rb', line 12

def format_message(severity, timestamp, progname, msg)
  case severity
  when "INFO"
    "#{msg}\n"
  when "ERROR"
    "#{severity.bold.red} #{msg}\n"
  when "WARN"
    "#{severity.downcase.bold.yellow} #{msg}\n"
  else
    "#{severity[0].bold.blue} #{msg}\n"
  end 
end

#trace?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/awsom/custom_logger.rb', line 29

def trace?
  @trace
end