lib/semantic_logger/formatters/base.rb in semantic_logger-4.6.1 vs lib/semantic_logger/formatters/base.rb in semantic_logger-4.7.0
- old
+ new
@@ -1,10 +1,10 @@
-require 'time'
+require "time"
module SemanticLogger
module Formatters
class Base
- attr_accessor :time_format, :log_host, :log_application, :log_environment, :precision
+ attr_accessor :log, :logger, :time_format, :log_host, :log_application, :log_environment, :precision
# Time precision varies by Ruby interpreter
# JRuby 9.1.8.0 supports microseconds
PRECISION =
if defined?(JRuby)
@@ -59,10 +59,15 @@
# Date & time
def time
format_time(log.time) if time_format
end
+ # Process ID
+ def pid
+ $$
+ end
+
private
# Return the Time as a formatted string
def format_time(time)
case time_format
@@ -75,10 +80,10 @@
when :none
time
when :seconds
time.to_f
when nil
- ''
+ ""
else
time.strftime(time_format)
end
end
end