summaryrefslogtreecommitdiffstats
path: root/ipalib/constants.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-10-31 18:55:32 -0600
committerJason Gerard DeRose <jderose@redhat.com>2008-10-31 18:55:32 -0600
commit5269d1396c2e299d7fc66b55df7a84d482927549 (patch)
treed9432036b387eab2ac81021c520a0fd39c56936f /ipalib/constants.py
parenta23d41a57f43c3a0f298d3918ae1712181fa544e (diff)
downloadfreeipa.git-5269d1396c2e299d7fc66b55df7a84d482927549.tar.gz
freeipa.git-5269d1396c2e299d7fc66b55df7a84d482927549.tar.xz
freeipa.git-5269d1396c2e299d7fc66b55df7a84d482927549.zip
Logging formats are now env variables; added log_format_stderr_debug format used when env.debug is True
Diffstat (limited to 'ipalib/constants.py')
-rw-r--r--ipalib/constants.py50
1 files changed, 33 insertions, 17 deletions
diff --git a/ipalib/constants.py b/ipalib/constants.py
index f4a440c6..7b0e1661 100644
--- a/ipalib/constants.py
+++ b/ipalib/constants.py
@@ -22,10 +22,38 @@
All constants centralized in one file.
"""
+
# The section to read in the config files, i.e. [global]
CONFIG_SECTION = 'global'
+# Log format for console output
+LOG_FORMAT_STDERR = ': '.join([
+ '%(name)s',
+ '%(levelname)s',
+ '%(message)s',
+])
+
+
+# Log format for console output when env.dubug is True:
+LOG_FORMAT_STDERR_DEBUG = ' '.join([
+ '%(levelname)s',
+ '%(message)r',
+ '%(lineno)d',
+ '%(filename)s',
+])
+
+
+# Tab-delimited log format for file (easy to opened in a spreadsheet):
+LOG_FORMAT_FILE = ' '.join([
+ '%(created)f',
+ '%(levelname)s',
+ '%(message)r', # Using %r for repr() so message is a single line
+ '%(lineno)d',
+ '%(pathname)s',
+])
+
+
# The default configuration for api.env
# This is a tuple instead of a dict so that it is immutable.
# To create a dict with this config, just "d = dict(DEFAULT_CONFIG)".
@@ -55,6 +83,11 @@ DEFAULT_CONFIG = (
('debug', False),
('mode', 'production'),
+ # Logging:
+ ('log_format_stderr', LOG_FORMAT_STDERR),
+ ('log_format_stderr_debug', LOG_FORMAT_STDERR_DEBUG),
+ ('log_format_file', LOG_FORMAT_FILE),
+
# ********************************************************
# The remaining keys are never set from the values here!
# ********************************************************
@@ -87,20 +120,3 @@ DEFAULT_CONFIG = (
('log', None), # Path to log file
)
-
-
-LOGGING_CONSOLE_FORMAT = ': '.join([
- '%(name)s',
- '%(levelname)s',
- '%(message)s',
-])
-
-
-# Tab-delimited format designed to be easily opened in a spreadsheet:
-LOGGING_FILE_FORMAT = ' '.join([
- '%(created)f',
- '%(levelname)s',
- '%(message)r', # Using %r for repr() so message is a single line
- '%(pathname)s',
- '%(lineno)d',
-])