module Shrine::Plugins::Logging::ClassMethods

  1. lib/shrine/plugins/logging.rb

Methods

Public Instance

  1. create_logger
  2. logger
  3. logger=
  4. pretty_formatter

Public Instance methods

create_logger ()
[show source]
   # File lib/shrine/plugins/logging.rb
34 def create_logger
35   logger = Logger.new(opts[:logging_stream])
36   logger.level = Logger::INFO
37   logger.level = Logger::WARN if ENV["RACK_ENV"] == "test"
38   logger.formatter = pretty_formatter
39   logger
40 end
logger ()
[show source]
   # File lib/shrine/plugins/logging.rb
30 def logger
31   @logger ||= opts[:logging_logger]
32 end
logger= (logger)
[show source]
   # File lib/shrine/plugins/logging.rb
26 def logger=(logger)
27   @logger = logger
28 end
pretty_formatter ()

It makes logging preamble simpler than the default logger. Also, it doesn't output timestamps if on Heroku.

[show source]
   # File lib/shrine/plugins/logging.rb
44 def pretty_formatter
45   proc do |severity, time, program_name, message|
46     output = "#{Process.pid}: #{message}\n".dup
47     output.prepend "#{time.utc.iso8601(3)} " unless ENV["DYNO"]
48     output
49   end
50 end