Skip to content

Instantly share code, notes, and snippets.

@IronSavior
Created August 19, 2016 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IronSavior/568f70536cc8dc2615821e1dedff3948 to your computer and use it in GitHub Desktop.
Save IronSavior/568f70536cc8dc2615821e1dedff3948 to your computer and use it in GitHub Desktop.
Minimalist program tracing with logger-like interface.
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