Language

Logging · Lesson 40 of 56

Multiplelogger

Source: 12-Logging In Python/12.2-multiplelogger.ipynb

Start here — no coding background needed

What you will learn

Separate log streams for different parts of an app.

In simple words

Like different notebooks: one for payments, one for login errors.

Leave notes while programs run — helps find bugs in real projects.

Easy example — try this first

Easy example — run this first. Change values and press Run again.

Python

Runs in your browser via Pyodide — no server. First run may take a few seconds.

Reference notes (from full bootcamp)

Optional — deeper detail for when you are ready

Logging with Multiple Loggers

You can create multiple loggers for different parts of your application.

Reference example
Python

Runs in your browser via Pyodide — no server. First run may take a few seconds.

Reference example
Python
Output
Expected (from notebook):
2024-06-19 13:21:55 - module1 - DEBUG - This is debug message for module1
2024-06-19 13:21:55 - module2 - WARNING - This is a warning message for module 2
2024-06-19 13:21:55 - module2 - ERROR - This is an error message

Runs in your browser via Pyodide — no server. First run may take a few seconds.

Practice test — try yourself

Write code, press Check. Wrong answer shows the correct code to copy & run.

You learned "Multiplelogger". Use print() to show: Done: Multiplelogger

Hint: Use one print() with the exact text.

Python