Created
August 19, 2016 21:58
-
-
Save IronSavior/568f70536cc8dc2615821e1dedff3948 to your computer and use it in GitHub Desktop.
Minimalist program tracing with logger-like interface.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Tracing | |
def trace_message( msg = yield ) | |
level = String(__callee__).upcase | |
puts ' ** [%s] %s: %s' % [level, self.class, msg] | |
end | |
%i[debug info warn error].each{ |m| alias_method m, :trace_message } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment