Skip to content

Commit

Permalink
Merge pull request #4 from kumparan/hotfix/change-level-type
Browse files Browse the repository at this point in the history
hotfix: change level parameter
  • Loading branch information
aslamhadi authored Oct 3, 2023
2 parents 14454fc + 6553199 commit 75f879e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Upils - unified python utils


<a name="0.2.0"></a>
## [0.2.0] - 2023-10-02
<a name="0.2.1"></a>
## [0.2.1] - 2023-10-03
### Fixes
- change level type

### New Features
- add loguru wrapper


<a name="v0.1.1"></a>
## v0.1.1 - 2023-09-29

[Unreleased]: https://github.com/kumparan/upils/compare/0.2.0...HEAD
[0.2.0]: https://github.com/kumparan/upils/compare/v0.1.1...0.2.0
[Unreleased]: https://github.com/kumparan/upils/compare/0.2.1...HEAD
[0.2.1]: https://github.com/kumparan/upils/compare/v0.1.1...0.2.1
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "upils"
version = "0.2.0"
version = "0.2.1"
description = "Unified Python Utils"
authors = ["Aslam Hadi Harsono <[email protected]>"]
readme = "README.md"
Expand Down
10 changes: 8 additions & 2 deletions upils/logging.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Module providing custom configuration for loguru"""
import json
import sys
from typing import Union

from loguru import logger

Expand Down Expand Up @@ -32,8 +33,13 @@ def patching(record):
record["extra"]["serialized"] = serialize(record)


def configure_logger(level: str) -> logger:
"""Configuration for custom loguru"""
def configure_logger(level: Union[str, int]) -> logger:
"""
Configuration for custom loguru
:param level: logging level. can be str or int.
https://docs.python.org/3/library/logging.html#logging-levels
"""

# remove default option from loguru. if we don't remove this, it will result in duplicated logs
logger.remove(0)
Expand Down

0 comments on commit 75f879e

Please sign in to comment.