Class: LSync::MinimalLogFormat

Inherits:
Object
  • Object
show all
Defined in:
lib/lsync/tee_logger.rb

Overview

A minimal log format that keeps track of the start time, and prints the minimal amount of information.

Instance Method Summary collapse

Constructor Details

#initializeMinimalLogFormat

Returns a new instance of MinimalLogFormat.



34
35
36
# File 'lib/lsync/tee_logger.rb', line 34

def initialize
	@start_time = nil
end

Instance Method Details

#call(severity, time, progname, msg) ⇒ Object



38
39
40
41
42
43
# File 'lib/lsync/tee_logger.rb', line 38

def call(severity, time, progname, msg)
	@start_time ||= time
	diff = time - @start_time
	
	"[T+#{sprintf('%0.1f', diff).ljust(5)} #{severity.rjust(5)}] #{msg}\n"
end