Sha256: 8a266201041f167cd2eb66a1a77e131f1a3e76ef78137c257a08a3ee7b8bbb13
Contents?: true
Size: 815 Bytes
Versions: 5
Compression:
Stored size: 815 Bytes
Contents
require 'tengine/support/config' class Tengine::Support::Config::Logger include Tengine::Support::Config::Definition field :output, 'file path or "STDOUT" / "STDERR" / "NULL".', :type => :string field :rotation, 'rotation file count or daily,weekly,monthly.', :type => :string field :rotation_size, 'number of max log file size.', :type => :integer field :level, 'debug/info/warn/error/fatal.', :type => :string def new_logger case output when "NULL" then return Tengine::Support::NullLogger.new when "STDOUT" then dev = STDOUT when "STDERR" then dev = STDERR else dev = output end shift_age = (rotation =~ /\A\d+\Z/) ? rotation.to_i : rotation result = Logger.new(dev, shift_age, rotation_size) result.level = Logger.const_get(level.upcase) result end end
Version data entries
5 entries across 5 versions & 1 rubygems