Module: check_mk
Branch: master
Commit: 4dc12663105d204d5bd070656bfab76c05f276be
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4dc12663105d20…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Wed Mar 28 12:17:15 2018 +0200
Comments only.
Change-Id: I4dc68f969fcdac80ddfeddac08a31fbd4a886477
---
cmk/log.py | 31 +++++++++++++++++++++++++++++++
cmk_base/console.py | 2 ++
2 files changed, 33 insertions(+)
diff --git a/cmk/log.py b/cmk/log.py
index b1ed75a..3181a1d 100644
--- a/cmk/log.py
+++ b/cmk/log.py
@@ -27,6 +27,37 @@
import sys
import logging as _logging
+# Just for reference, the predefined logging levels:
+#
+# syslog/CMC Python added to Python
+# --------------------------------------------
+# emerg 0
+# alert 1
+# crit 2 CRITICAL 50
+# err 3 ERROR 40
+# warn 4 WARNING 30 <= default level in Python
+# notice 5 <= default level in CMC
+# info 6 INFO 20
+# VERBOSE 15
+# debug 7 DEBUG 10
+#
+# NOTE: VERBOSE is a bit confusing and suffers from the not-invented-here
+# syndrome. If we really insist on 3 verbosity levels (normal, verbose, very
+# verbose), we should probably do the following:
+#
+# * Nuke VERBOSE.
+# * Introduce NOTICE (25).
+# * Make NOTICE the default level.
+# * Optionally introduce EMERGENCY (70) and ALERT (60) for consistency.
+#
+# This would make our whole logging story much more consistent internally
+# (code) and externally (GUI always offers the same levels). Nevertheless, we
+# should keep in mind that the Python documentation strongly discourages
+# introducing new log levels, at least for libraries. OTOH, with 3 verbosity
+# levels, this would force us to log normal stuff with a WARNING level, which
+# looks wrong.
+
+
# Users should be able to set log levels without importing "logging"
CRITICAL = _logging.CRITICAL
diff --git a/cmk_base/console.py b/cmk_base/console.py
index d657e5c..09f70de 100644
--- a/cmk_base/console.py
+++ b/cmk_base/console.py
@@ -32,6 +32,8 @@ import sys
import cmk.tty as tty
import cmk.log
+# NOTE: This is a hack! We abuse the global logger just to pass around the
+# verbosity setting.
logger = cmk.log.get_logger("base")
#