module Alog
Constants
- CondLog
Actual logic of detecting a tag should be activated and on which logger should it written to
- GLog
multi logger created from
LogFacts
entry given by application- LogFacts
allow application to configure multiple logging log factories configurations
- LogTag
allow application to provide which tag should print out
- VERSION
Public Instance Methods
add_log_fact(key, conf)
click to toggle source
# File lib/alog.rb, line 19 def add_log_fact(key, conf) # add new log fact to global if not defined if LogFacts.include?(key) else LogFacts[key] = conf end end
clog(msg, ltype = :debug, key = :global, logEng = [])
click to toggle source
Module level clog() method Meant to be called by application INSIDE the l()'s block
# File lib/alog.rb, line 165 def clog(msg, ltype = :debug, key = :global, logEng = []) log(msg, { type: @lType != ltype ? ltype : @lType, key: (key != @lKey ? key : @lKey), logEng: @llEng }) end
clog_context()
click to toggle source
# File lib/alog.rb, line 157 def clog_context { key: @lKey, type: @lType, engine: @llEng } end
l(key = :global, params = { type: :debug, logEng: [] } ,&block)
click to toggle source
Provide a block construct that can set values consistantly for multiple clog() call TODO How to make this thread safe?
# File lib/alog.rb, line 143 def l(key = :global, params = { type: :debug, logEng: [] } ,&block) # this construct try to make the variable private to the block # Still not sure will error condition exist for multi threaded application b = Proc.new do |key, params, &block| @lKey = key @lType = params[:type] @llEng = params[:logEng] if block block.call end end b.call(key, params, &block) end
log(msg, params = { }, &block)
click to toggle source
provide module level method to write to the logger object
# File lib/alog.rb, line 222 def log(msg, params = { }, &block) CondLog.call(msg, params, &block) end