Sha256: a8fcdcf1355c884b537358157dc50df08652a4bd29c4b548ba844867fd7aef69
Contents?: true
Size: 1.21 KB
Versions: 19
Compression:
Stored size: 1.21 KB
Contents
require "mcollective/logger/console_logger" module MCollective module Util class Playbook class Playbook_Logger < Logger::Console_logger attr_writer :scope def initialize(playbook) @playbook = playbook @report = playbook.report super() end def start set_level(@playbook.loglevel.intern) end def log(level, from, msg, normal_output=$stderr, last_resort_output=$stderr) if @playbook.loglevel != "debug" if should_show? console_from = "%s#%-25s" % [@playbook.name, @playbook.context] else level = :debug end end if @known_levels.index(level) >= @known_levels.index(@active_level) r_time = Time.now s_time = r_time.strftime("%H:%M:%S") @report.append_log(r_time, level, from, msg) normal_output.puts("%s %s: %s %s" % [colorize(level, level[0].capitalize), s_time, console_from, msg]) end rescue last_resort_output.puts("%s: %s" % [level, msg]) end def should_show? !caller(1..5).grep(/playbook/).empty? end end end end end
Version data entries
19 entries across 19 versions & 1 rubygems