Sha256: 160adf51c6b262c09868b2971c13eb6e8879ec1963f2537251bbc4a03fe8ba15
Contents?: true
Size: 1012 Bytes
Versions: 4
Compression:
Stored size: 1012 Bytes
Contents
# coding: utf-8 require "logger" module <%=@module_name%> # Reader method for the logger of Lapidary # @return [Logger] Logger object def self.logger if @logger.nil? @logger = (rails_logger || default_logger) @logger.formatter = proc { |severity, datetime, progname, msg| datetime.strftime("[%Y-%m-%d %H:%M:%S](#{severity}) #{msg}\n") } end return @logger end # Reader method for the rails logger of Lapidary # @return [Logger] Logger object def self.rails_logger (defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger) || (defined?(RAILS_DEFAULT_LOGGER) && RAILS_DEFAULT_LOGGER.respond_to?(:debug) && RAILS_DEFAULT_LOGGER) end # Reader method for the default logger of Lapidary # @return [Logger] Logger object def self.default_logger l = Logger.new(STDERR) l.level = Logger::INFO l end # Writer method for the logger of Lapidary # @param logger [Logger] def self.logger=(logger) @logger = logger end end
Version data entries
4 entries across 4 versions & 1 rubygems