-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from kumparan/feature/extra-log
feature: add extra log
- Loading branch information
Showing
7 changed files
with
37 additions
and
101 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,35 @@ | ||
# unified python utils | ||
# Unified Python Utils | ||
|
||
Collection of python library utils | ||
|
||
## Installation | ||
|
||
```poetry add upils``` | ||
|
||
## How to use the logger | ||
|
||
First, set up the logger. It accepts string like "INFO" or int 20 | ||
|
||
```logger = configure_logger(20)``` | ||
|
||
And then you can just use it like other logger | ||
|
||
``` | ||
logger.info("info") | ||
logger.warning("warning") | ||
``` | ||
|
||
### Add extra information | ||
How to use the extra logging: | ||
|
||
``` | ||
logger.bind(user="ajung", desc="smart").error( | ||
"Inline binding of extra attribute" | ||
) | ||
``` | ||
|
||
The output will be | ||
|
||
``` | ||
{"level": "ERROR", "time": {"repr": "2023-10-04 12:03:53.043106+07:00", "timestamp": 1696395833.043106}, "message": "Inline binding of extra attribute", "file": {"name": "app.py", "path": "/Users/user/Documents/projects/de-projects/service/statistics-services/app.py"}, "line": 47, "exception": null, "extra": {"ajung": "smart"}} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "upils" | ||
version = "0.2.1" | ||
version = "0.2.2" | ||
description = "Unified Python Utils" | ||
authors = ["Aslam Hadi Harsono <[email protected]>"] | ||
readme = "README.md" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters