aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorfabrixxm <fabrixxm@kirgroup.net>2021-08-11 21:03:04 +0200
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2021-08-12 08:41:19 +0200
commit40dbbef3d7189d89e613e11058741dbfb8114e38 (patch)
tree345c6b61b1d732accaef9942dddf4396e7cd7321 /scripts
parent04a2a58447104e01a4f388fc8c1446f4bc5de634 (diff)
Per-module logger, add cli switch to log debug
when using lesana as a library, having a per-module logger is better instead of logging everything in root. When `lesana` cli command is used, logger is configured to print simple logline and loglevel is set to INFO, unless user pass the option `-v` or `--verbose` which sets the level to DEBUG
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/lesana11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/lesana b/scripts/lesana
index 51d5f7a..8f38a67 100755
--- a/scripts/lesana
+++ b/scripts/lesana
@@ -2,7 +2,7 @@
"""
Lesana Command Line interface
"""
-
+import logging
import lesana.command
@@ -26,4 +26,13 @@ class Lesana(lesana.command.MainCommand):
if __name__ == "__main__":
+
+ # setup logging for lesana cli
+ logger = logging.getLogger('lesana')
+ ch = logging.StreamHandler()
+ formatter = logging.Formatter('%(levelname)s: %(message)s')
+ ch.setFormatter(formatter)
+ logger.addHandler(ch)
+ logger.setLevel(logging.INFO)
+
Lesana().main()