Created
June 26, 2015 20:57
-
-
Save lwcolton/2a2e5618c99774135d32 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 logging | |
from logging.handlers import RotatingFileHandler | |
from driftwood.formatters import JSONFormatter | |
logger = logging.getLogger("myapp") | |
json_file_handler = RotatingFileHandler("/var/log/test.json", backupCount=2) | |
json_file_handler.setFormatter(JSONFormatter(preserve_order=True, | |
specific_order=["created"], | |
regular_attrs = ["created", "levelname", "message", "pathname", "lineno", | |
"funcName", "process", "levelno"])) | |
logger.addHandler(json_file_handler) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment