Skip to content

Instantly share code, notes, and snippets.

@philippegirard
Last active March 9, 2023 08:27
Show Gist options
  • Save philippegirard/e842d29d22bbc340a9d0e19dca3328d4 to your computer and use it in GitHub Desktop.
Save philippegirard/e842d29d22bbc340a9d0e19dca3328d4 to your computer and use it in GitHub Desktop.
FastAPI logging
[loggers]
keys=root,uicheckapp
[handlers]
keys=consoleHandler,detailedConsoleHandler
[formatters]
keys=normalFormatter,detailedFormatter
[logger_root]
level=INFO
handlers=consoleHandler
[logger_uicheckapp]
level=DEBUG
handlers=detailedConsoleHandler
qualname=uicheckapp
propagate=0
[handler_consoleHandler]
class=StreamHandler
level=DEBUG
formatter=normalFormatter
args=(sys.stdout,)
[handler_detailedConsoleHandler]
class=StreamHandler
level=DEBUG
formatter=detailedFormatter
args=(sys.stdout,)
[formatter_normalFormatter]
format=%(asctime)s loglevel=%(levelname)-6s logger=%(name)s %(funcName)s() L%(lineno)-4d %(message)s
[formatter_detailedFormatter]
format=%(asctime)s loglevel=%(levelname)-6s logger=%(name)s %(funcName)s() L%(lineno)-4d %(message)s call_trace=%(pathname)s L%(lineno)-4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment