Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
Bardreamaster committed Dec 12, 2024
1 parent cc71f32 commit a68d848
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion src/sharklog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,17 @@
setLogRecordFactory,
shutdown,
)
from .logging import critical, debug, error, exception, getLogger, info, init, warning, reset_all
from .logging import (
critical,
debug,
error,
exception,
getLogger,
info,
init,
warning,
reset_all,
)

__all__ = [
"BASIC_FORMAT",
Expand Down
3 changes: 2 additions & 1 deletion src/sharklog/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sharklog import settings, utils


def init(name: str=None, debug: bool=False, level=None, **kwargs):
def init(name: str = None, debug: bool = False, level=None, **kwargs):
if debug:
settings.DEFAULT_LEVEL = logging.DEBUG
elif level is not None:
Expand Down Expand Up @@ -38,6 +38,7 @@ def init(name: str=None, debug: bool=False, level=None, **kwargs):
logger.setLevel(kwargs["level"])
return logger


def reset_all(debug=False, level=None, **kwargs):
if debug:
settings.DEFAULT_LEVEL = logging.DEBUG
Expand Down
9 changes: 9 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import sharklog

sharklog.init(debug=True) # init current logger with level=sharklog.DEBUG

sharklog.debug("debug message")

sharklog.info("info message")
sharklog.warning("warning message")
sharklog.error("error message")

0 comments on commit a68d848

Please sign in to comment.