-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: colored logging formatter #348
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Avik Basu <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #348 +/- ##
==========================================
+ Coverage 92.31% 92.39% +0.07%
==========================================
Files 82 82
Lines 3918 3931 +13
Branches 325 325
==========================================
+ Hits 3617 3632 +15
+ Misses 233 230 -3
- Partials 68 69 +1 ☔ View full report in Codecov by Sentry. |
super().__init__(*args, **kwargs) | ||
self._formats = { | ||
logging.DEBUG: f"{self.BLUE}{self._fmt}{self.RESET}", | ||
logging.INFO: f"{self.WHITE}{self._fmt}{self.RESET}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ensure that the text background won't be WHITE as well?
} | ||
|
||
def format(self, record): | ||
self._style._fmt = self._formats.get(record.levelno) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to prepare for the case when a new / typo logging level is introduced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how do we turn this on/off? it looks like it is always on, and this ("ANSI Escape Codes") might not work everywhere.
I think we should add this switch. Apparently windows OS also have problem with colors. I remember that "loguru" added external library called "colorama" to solve for Windows. |
closes #312