Skip to content

Interfacing with logger_tt #426

Description

@ChristianMichelsen

Hi and thanks for a great package - especially now with the Rich integration!

I have implemented a CLI package with Typer and I want to use it together with logger_tt.
Without logger_tt everything works as expected:

import typer
from logger_tt import logger, setup_logging


with_logging = False


def main(name: str):

    if with_logging:
        setup_logging()

    print(f"Hello {name}")
    print("Hello" + 3)


if __name__ == "__main__":
    typer.run(main)

and run it with python typer_test.py ExampleName. This produces the following result in my terminal:
Screenshot 2022-07-14 at 15 29 09

Compare this to the result when using logger_tt (i.e. setting with_logging = True above):
Screenshot 2022-07-14 at 15 28 34

How does one make Typer and logger_ttto play together nicely?

I completely understand if you feel that this isn't a issue with Typer but rather logger_tt, however, maybe I am just overlooking a simple setting that'll make it work.

Operating System

macOS

Operating System Details

macOS Monterey, 12.4. Macbook Pro 14-inch 2021, M1 Pro.

Typer Version

0.6.1

Python Version

Python 3.10.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion or problem

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions