-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16c3b18
commit e1f8546
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
id: python-generate-logs | ||
namespace: company.team | ||
|
||
tasks: | ||
- id: python_logger | ||
type: io.kestra.plugin.scripts.python.Script | ||
allowFailure: true | ||
warningOnStdErr: false | ||
beforeCommands: | ||
- pip install kestra | ||
script: | | ||
import time | ||
from kestra import Kestra | ||
logger = Kestra.logger() | ||
logger.debug("DEBUG is used for diagnostic info.") | ||
time.sleep(0.5) | ||
logger.info("INFO confirms normal operation.") | ||
time.sleep(0.5) | ||
logger.warning("WARNING signals something unexpected.") | ||
time.sleep(0.5) | ||
logger.error("ERROR indicates a serious issue.") | ||
time.sleep(0.5) | ||
logger.critical("CRITICAL means a severe failure.") | ||
extend: | ||
title: Run a Python script and capture logs | ||
description: >- | ||
This flow generates logs using the `Kestra.logger()` method from the [Kestra pip package](https://github.com/kestra-io/libs) | ||
to instantiate a `logger` object — this logger is configured to correctly capture all Python log | ||
levels and send them to the Kestra backend. | ||
tags: | ||
- Python | ||
- pip | ||
- Software Engineering | ||
ee: false | ||
demo: true | ||
meta_description: This flow generates a number of logs at different levels using the `Kestra.logger()` method |