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

Add the mandr logger to give the user full control over logging #35

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

thomass-dev
Copy link
Collaborator

image

src/mandr/app.py Outdated
@@ -83,8 +82,8 @@ def render_top_nav(*args):
for g in glob
if g.is_dir() and not g.parts[-1].startswith("_")
]
console.log(f"{links_out=}")
console.log(f"{path_pairs=}")
logger.info(f"{links_out=}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would log at debug level here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

src/mandr/app.py Outdated
@@ -122,7 +121,7 @@ def home(path):
if len(path) == 0:
return render_mander(*[])
path_parts = path.split("/")
console.log(f"{path_parts=}")
logger.info(f"{path_parts=}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As well, I would log at debug level.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

app = Flask(__name__)
logger = logging.getLogger(__name__)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's quite annoying that they do not respect the usual function naming conventions. Is there a reason to use Rich specifically? I would appreciate an alternative.

Copy link
Collaborator Author

@thomass-dev thomass-dev Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not Rich here, its the standard python logging library.
Its usual for the standard libraries in cpython that function respects camel case.
There is no alternative in the logging library to do this with a snake case function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah my bad, now I see.

@tuscland tuscland merged commit f9de141 into main Jul 12, 2024
1 check passed
@tuscland tuscland deleted the feat/logger branch July 12, 2024 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants