Sha256: 91165d5cb5a3631d7cef8072886e638764bab39a16f77ec2405bffe383a7c7cc
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
require 'logger' module WinCI module Updater class TLogger < Logger attr_reader :logger def initialize(file, shift_age, stdout, verbose=false) @logger = Logger.new(file, shift_age) @logger.level = Logger::INFO @verbose = verbose @stdout = stdout end def log(str, lvl=:info) @logger.send(lvl, str) if lvl == :fatal raise str elsif (@verbose or !(lvl == :info)) @stdout.puts(str) if (@verbose or !(lvl == :info)) end end def info(str, lvl=:info) @logger.send(lvl, str) if lvl == :fatal raise str elsif (@verbose or !(lvl == :info)) @stdout.puts(str) if (@verbose or !(lvl == :info)) end end def debug(str, lvl=:debug) @logger.send(lvl, str) if lvl == :fatal raise str elsif (@verbose or !(lvl == :info)) @stdout.puts(str) if (@verbose or !(lvl == :info)) end end def fatal(str, lvl=:fatal) @logger.send(lvl, str) if lvl == :fatal raise str elsif (@verbose or !(lvl == :info)) @stdout.puts(str) if (@verbose or !(lvl == :info)) end end end # of Class TLogger end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
winci-updater-0.0.3 | lib/winci-updater/logger.rb |
winci-updater-0.0.2 | lib/winci-updater/logger.rb |
winci-updater-0.0.1 | lib/winci-updater/logger.rb |