Class: Tailor::Logger

Inherits:
Object
  • Object
show all
Extended by:
LogSwitch
Defined in:
lib/tailor/logger.rb

Defined Under Namespace

Modules: Mixin

Class Method Summary collapse

Class Method Details

.format_message(_, time, _, msg) ⇒ Object



13
14
15
# File 'lib/tailor/logger.rb', line 13

def @logger.format_message(_, time, _, msg)
  "[#{time.strftime('%Y-%m-%d %H:%M:%S')}]  #{msg}\n"
end

.loggerObject

Overrides the LogSwitch Logger to custom format the time format in log messages.



9
10
11
12
13
14
15
16
17
18
# File 'lib/tailor/logger.rb', line 9

def self.logger
  return @logger if @logger
  @logger ||= ::Logger.new $stdout

  def @logger.format_message(_, time, _, msg)
    "[#{time.strftime('%Y-%m-%d %H:%M:%S')}]  #{msg}\n"
  end

  @logger
end