Last active
February 7, 2017 16:42
-
-
Save udoprog/b4603a1842b35c3a0a7ebc3bfc130ab7 to your computer and use it in GitHub Desktop.
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
| import datetime | |
| import sys | |
| import json | |
| def printThrown(thrown): | |
| if 'message' in thrown: | |
| print " {name}: {message}".format(**thrown) | |
| else: | |
| print " {name}".format(**thrown) | |
| if 'extendedStackTrace' in thrown: | |
| for entry in thrown['extendedStackTrace']: | |
| print " at {class}.{method}({file}:{line})".format(**entry) | |
| if 'cause' in thrown: | |
| print " caused by:" | |
| printThrown(thrown['cause']) | |
| for line in sys.stdin: | |
| doc = json.loads(line) | |
| ms = doc['timeMillis'] | |
| timestamp = datetime.datetime.fromtimestamp(ms/1000.0) | |
| print timestamp.isoformat() + ": " + doc['message'] | |
| if 'thrown' in doc: | |
| thrown = doc['thrown'] | |
| printThrown(doc['thrown']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment