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 global logger at __init__.py with RichHandler #45

Merged
merged 6 commits into from
Jan 24, 2024
Merged

Conversation

vkehfdl1
Copy link
Contributor

close #42

I add global logger at autorag/init.py.
But, when you use it, do not import directly from autorag/init.py because it will potentially occur circular import error.
Instead, you can get logger like below code. Remember logger instance have same name is singleton.

import logging
logger = logging.getLogger("AutoRAG")

I use RichHandler instead of StreamHandler for beautiful formatting.
Plus, I use rich exception for beautiful inspection while debugging.
You can see rich logging by deleting last two lines of your pytest.ini
Change pytest.ini looks like this.

[pytest]
env =
    OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx

log_cli=true
log_cli_level=INFO

@vkehfdl1 vkehfdl1 enabled auto-merge (squash) January 23, 2024 18:09
Copy link
Contributor

@bwook00 bwook00 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@Eastsidegunn Eastsidegunn left a comment

Choose a reason for hiding this comment

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

@vkehfdl1 vkehfdl1 merged commit 89dcad5 into main Jan 24, 2024
3 checks passed
@vkehfdl1 vkehfdl1 deleted the Feature/#42 branch January 24, 2024 11:51
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.

implement logging
3 participants