-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: print logs in json format (#141)
- Loading branch information
Showing
3 changed files
with
22 additions
and
2 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import json | ||
|
||
|
||
# NOTE: we probably should've created a proper `logging.getLogger` here, | ||
# but it handling `source` would be not trivial, so we are better off | ||
# just keeping it simple for now. | ||
class IsolateLogger: | ||
def log(self, level, message, source): | ||
record = { | ||
"isolate_source": source.name, | ||
"level": level.name, | ||
"message": message, | ||
} | ||
print(json.dumps(record)) | ||
|
||
|
||
logger = IsolateLogger() |