Skip to content

Instantly share code, notes, and snippets.

@binarybrat
Created December 22, 2023 03:17
Show Gist options
  • Save binarybrat/057563ed3807c794cc45d4950d35d5fe to your computer and use it in GitHub Desktop.
Save binarybrat/057563ed3807c794cc45d4950d35d5fe to your computer and use it in GitHub Desktop.
Msstly working submodule logging config example
[loggers]
keys = root, main_app, first_library, second_library
[handlers]
keys = console
[formatters]
keys = generic, full, brief
[logger_root]
level = INFO
handlers = console
[logger_main_app]
level = INFO
handlers =
qualname = main_app
[logger_first_library]
level = INFO
handlers =
qualname = first_library
[logger_second_library]
level = INFO
handlers =
qualname = second_library
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[handler_fileHandler]
class=handlers.RotatingFileHandler
formatter=full
args=('logs/server.log', 'w', 1500, 20)
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s] [%(threadName)s] %(message)s
[formatter_full]
format= [{}%(asctime)s %(levelname)s %(funcName)s{}] %(message)s
[formatter_brief]
format= %(message)s
[formatter_issueFormatter]
format= {}[%(asctime)s] [%(levelname)s] [%(color_term)s:%(funcName)s] [%(filename)s:%(lineno)d]{} %(message)s
# https://git.dglloyd.net/dlloyd/logging_demo
from main_app.app import MainApp
app = MainApp()
def main():
app.run()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment