Sha256: a80ed6356afc77cc584c34cfc9380cb1817e4b795f9535b4b61dc2d9cc4f35b3
Contents?: true
Size: 739 Bytes
Versions: 1
Compression:
Stored size: 739 Bytes
Contents
require 'logger' require 'fileutils' module Ginatra module Logger def logger Logger.logger end def self.logger return @logger if @logger if Ginatra.config.log_file log_file = File.expand_path(Ginatra.config.log_file) else log_file = STDOUT end unless log_file == STDOUT parent_dir, _separator, _filename = log_file.rpartition('/') FileUtils.mkdir_p parent_dir FileUtils.touch log_file end @logger = ::Logger.new log_file @logger.level = ::Logger::WARN @logger.formatter = proc do |severity, datetime, progname, msg| "[#{datetime} ##{Process.pid}] #{severity}: #{msg}\n" end @logger end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ginatra-4.1.0 | lib/ginatra/logger.rb |