Module: check_mk
Branch: master
Commit: 42c9412dc337bfa6d07d565788f14f9bf323a4cd
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=42c9412dc337bf…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Oct 30 13:33:23 2012 +0100
Added log method to html class for debug logging to apache error log
---
web/htdocs/htmllib.py | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 9bbc669..2a303ce 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -24,7 +24,7 @@
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301 USA.
-from mod_python import Cookie
+from mod_python import Cookie, apache
import time, cgi, config, os, defaults, pwd, urllib, weblib, random
from lib import *
# Python 2.3 does not have 'set' in normal namespace.
@@ -1186,6 +1186,16 @@ class html:
for element in x:
self.write("<pre>%s</pre>\n" %
pprint.pformat(element))
+ # Debug logging directly to apache error_log
+ # Even if this is for debugging purpose, set the log-level to WARN in all cases
+ # since the apache in OMD sites has LogLevel set to "warn" by default which
would
+ # suppress messages generated here. Again, this is only for debugging during
+ # development, so this should be no problem for regular users.
+ def log(self, msg):
+ if type(msg) != str:
+ msg = repr(msg)
+ self.req.log_error(msg, apache.APLOG_WARNING)
+
def debug_vars(self):
self.write('<table
onmouseover="this.style.display=\'none\';" class=debug_vars>')
self.write("<tr><th colspan=2>POST / GET
Variables</th></tr>")