New to Kestra?
Use blueprints to kickstart your first workflows.
Run a Python script with Loguru in Kestra, map log levels to Kestra logs, and control verbosity at runtime with a configurable input parameter.
Configure clean, structured logging in a Python script using Loguru and run it inside Kestra so every message surfaces in the Kestra execution logs at the right severity. This blueprint solves a common problem for data engineers and Python developers: making script output observable, level-aware, and reproducible inside an orchestrator instead of buried in stdout. It generates a configurable batch of fake log lines so you can see exactly how Loguru levels map to Kestra log levels.
nr_logs (type INT, default 100), which
controls how many log messages are produced at runtime.reproducer task of type io.kestra.plugin.scripts.python.Script
runs the Python code defined in its script property.taskRunner
(io.kestra.plugin.scripts.runner.docker.Docker) and declares its
dependencies (loguru and faker), so the packages are installed in an
isolated container at runtime.logger.remove() and two
sinks: sys.stdout at level INFO and sys.stderr at level WARNING.logger.debug line (filtered out by the INFO
threshold), logger.warning markers around the loop, and one logger.info
line per generated Faker sentence.logger.info mapped to INFO logs and logger.warning mapped to WARN logs
inside Kestra.logger.debug is suppressed when the level is set to INFO.nr_logs input.Kestra turns an ad hoc script into a governed, observable workflow. Log levels are captured and rendered natively in the UI, runs are reproducible thanks to declarative YAML and Docker-isolated dependencies, and you gain retries, event and schedule triggers, and full execution lineage. A bare Python script has no scheduler, no run history, and no centralized log view: Kestra fills exactly that gap.
This flow uses no secrets. It runs entirely from public PyPI packages
(loguru, faker) installed at runtime.
nr_logs.logger.debug line does not appear.DEBUG to surface debug messages.