Logging with custom formatter
sidify opened this issue · 1 comments
sidify commented
Trying to log with specific formatter, landing up in the error:
File "/home/sid/miniconda3/envs/locas_3.10/lib/python3.10/site-packages/json_logging/__init__.py", line 120, in __init
if not issubclass(custom_formatter, logging.Formatter):
TypeError: issubclass() arg 1 must be a class
This is what I am trying to do:
import json_logging
import logging
fmt = logging.Formatter(fmt='%(filename)s')
json_logging.init_fastapi(enable_json=False, custom_formatter=fmt)
Python version: 3.8 and 3.10
json-logging~=1.3
fastapi~=0.85
bobbui commented
it should be a class not a class instance, what u should pass into the method is a subclass of logging.Formatter