Skip to content

Commit fd6922f

Browse files
committed
expose logger
1 parent 1eb311b commit fd6922f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ distribution = true
2626
[tool.pdm.scripts]
2727
post_install = "scripts/post_install.py"
2828

29-
[tool.pdm.publish]
30-
upload.env_file = "$HOME/.pypienv"
31-
3229
[tool.pdm.version]
3330
source = "scm"
3431

spells/log.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ def rotate_logs():
4242
logging.debug("Log file manually rotated")
4343

4444

45-
@contextmanager
46-
def console_logging(log_level):
45+
def add_console_handler(log_level):
4746
console_handler = logging.StreamHandler(sys.stdout)
4847
console_handler.setLevel(log_level)
4948
formatter = logging.Formatter(
@@ -52,7 +51,12 @@ def console_logging(log_level):
5251
console_handler.setFormatter(formatter)
5352
logger = logging.getLogger()
5453
logger.addHandler(console_handler)
54+
return logger, console_handler
55+
5556

57+
@contextmanager
58+
def console_logging(log_level):
59+
logger, console_handler = add_console_handler(log_level)
5660
try:
5761
yield
5862
finally:

0 commit comments

Comments
 (0)