Skip to content

Commit

Permalink
fix logger name
Browse files Browse the repository at this point in the history
get the file name as its logger name if run as __main__
  • Loading branch information
Bardreamaster authored Dec 18, 2024
1 parent a68d848 commit 0a5f392
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/sharklog/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def init(name: str = None, debug: bool = False, level=None, **kwargs):
name = frame.f_globals["__name__"]
if name == "__main__":
try:
name = frame.f_globals["__file__"].split(".")[0].replace("/", ".")
name = frame.f_globals["__file__"].split(".")[0].split("/")[-1]
except KeyError:
name = "interactive"
logger = logging.getLogger(name)
Expand Down

0 comments on commit 0a5f392

Please sign in to comment.