Created
October 20, 2015 16:28
-
-
Save evanphx/cfbfeaeaaa0f0841e0a6 to your computer and use it in GitHub Desktop.
Structured Logging
This file contains 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
require 'json' | |
class SLogger | |
def log(event, opts={}) | |
opts[:event] = event.to_s | |
emit opts | |
end | |
def emit(opts) | |
$stdout.puts JSON.generate(opts) | |
end | |
end | |
SLog = SLogger.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment