Module: ThreadedLogging
- Defined in:
- lib/threaded_logging.rb,
lib/threaded_logging/version.rb
Constant Summary collapse
- FORMAT =
"%s [%s] #%s: %s"
- VERSION =
"1.0.0"
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.thread_fingerprint ⇒ Object
8 9 10 |
# File 'lib/threaded_logging.rb', line 8 def self.thread_fingerprint Digest::MD5.hexdigest([Thread.current.object_id, $PID].join)[0...8] end |
Instance Method Details
#call(severity, time, _progname, msg) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/threaded_logging.rb', line 14 def call(severity, time, _progname, msg) = +"" msg2str(msg).to_s.lines.each do |line| << format( FORMAT, severity[0], format_datetime(time), ThreadedLogging.thread_fingerprint, line ) end << "\n" end |