Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable debug logging only if JOFT_DEBUG env var is defined #30

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ To run the actions from your yaml template file run:

`joft run --template ./<path to your yaml template>`

If you need more verbose output for debugging, define `JOFT_DEBUG=1` environment variable.

## Docs

Documentation can be found [here](docs/introduction.md).
11 changes: 9 additions & 2 deletions joft/cli.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import os
import sys

import click
Expand All @@ -8,6 +9,12 @@
import joft.utils


if os.getenv("JOFT_DEBUG"):
logging_level = logging.DEBUG
else:
logging_level = logging.WARNING


@click.group()
@click.pass_context
def main(ctx) -> None:
Expand All @@ -26,7 +33,7 @@ def validate(template) -> int:
@click.option("--template", help="File path to the template file.")
@click.pass_obj
def run(ctx, template: str) -> int:
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.DEBUG)
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging_level)
logging.info(
f"Establishing session with jira server: {ctx['jira']['server']['hostname']}:"
)
Expand All @@ -47,7 +54,7 @@ def run(ctx, template: str) -> int:
@click.option("--template", help="File path to the template file.")
@click.pass_obj
def list_issues(ctx, template: str) -> None:
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.DEBUG)
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging_level)
logging.info(
f"Establishing session with jira server: {ctx['jira']['server']['hostname']}:"
)
Expand Down
Loading