summaryrefslogtreecommitdiff
path: root/Omni/Log.py
diff options
context:
space:
mode:
Diffstat (limited to 'Omni/Log.py')
-rw-r--r--Omni/Log.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Omni/Log.py b/Omni/Log.py
index 2fbd007..e644a1a 100644
--- a/Omni/Log.py
+++ b/Omni/Log.py
@@ -1,6 +1,5 @@
"""Setup logging like Omni/Log.hs."""
-# noqa: builtin-attribute-shadowing
import logging
import typing
@@ -14,10 +13,10 @@ class LowerFormatter(logging.Formatter):
return super(logging.Formatter, self).format(record) # type: ignore[misc]
-def setup() -> None:
+def setup(level: int = logging.INFO) -> logging.Logger:
"""Run this in your __main__ function."""
logging.basicConfig(
- level=logging.DEBUG,
+ level=level,
format="%(levelname)s: %(name)s: %(message)s",
)
logging.addLevelName(logging.DEBUG, "dbug")
@@ -28,6 +27,7 @@ def setup() -> None:
handler = logging.StreamHandler()
handler.setFormatter(formatter)
logger.addHandler(handler)
+ return logger
if __name__ == "__main__":