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.



53
54
55
# File 'lib/lsync/tee_logger.rb', line 53

def initialize
	@start_time = nil
end

Instance Method Details

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



57
58
59
60
61
62
# File 'lib/lsync/tee_logger.rb', line 57

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