Commit bd83764d authored by Fred Drake's avatar Fred Drake

Refine the log handlers in the zLOG schema component a bit to make

configuration files easier to read.
parent 562d9c29
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<sectiontype name="syslog" datatype=".syslog_handler" <sectiontype name="syslog" datatype=".syslog_handler"
implements="loghandler" extends="base-log-handler"> implements="loghandler" extends="base-log-handler">
<key name="facility" default="user" datatype=".syslog_facility"/> <key name="facility" default="user" datatype=".syslog_facility"/>
<key name="address" datatype="socket-address" required="yes"/> <key name="address" datatype="socket-address" default="localhost:514"/>
<key name="format" default="%(message)s" <key name="format" default="%(message)s"
datatype=".log_format"/> datatype=".log_format"/>
</sectiontype> </sectiontype>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<sectiontype name="http-logger" datatype=".http_handler" <sectiontype name="http-logger" datatype=".http_handler"
implements="loghandler" extends="base-log-handler"> implements="loghandler" extends="base-log-handler">
<key name="url" default="localhost" datatype=".http_handler_url"/> <key name="url" default="http://localhost/" datatype=".http_handler_url"/>
<key name="method" default="GET" datatype=".get_or_post"/> <key name="method" default="GET" datatype=".get_or_post"/>
<key name="format" default="%(asctime)s %(message)s" <key name="format" default="%(asctime)s %(message)s"
datatype=".log_format"/> datatype=".log_format"/>
...@@ -44,10 +44,10 @@ ...@@ -44,10 +44,10 @@
<sectiontype name="email-notifier" datatype=".smtp_handler" <sectiontype name="email-notifier" datatype=".smtp_handler"
implements="loghandler" extends="base-log-handler"> implements="loghandler" extends="base-log-handler">
<key name="fromaddr" required="yes"/> <key name="from" required="yes" attribute="fromaddr"/>
<multikey name="toaddr" required="yes" attribute="toaddrs"/> <multikey name="to" required="yes" attribute="toaddrs"/>
<key name="subject" default="Message from Zope"/> <key name="subject" default="Message from Zope"/>
<key name="host" default="localhost" datatype="inet-address"/> <key name="smtp-server" default="localhost" datatype="inet-address"/>
<key name="format" default="%(asctime)s %(message)s" <key name="format" default="%(asctime)s %(message)s"
datatype=".log_format"/> datatype=".log_format"/>
</sectiontype> </sectiontype>
......
...@@ -120,9 +120,9 @@ _syslog_facilities = { ...@@ -120,9 +120,9 @@ _syslog_facilities = {
def syslog_facility(value): def syslog_facility(value):
value = value.lower() value = value.lower()
if not _syslog_facilities.has_key(value): if not _syslog_facilities.has_key(value):
raise ValueError( L = _syslog_facilities.keys()
"Syslog facility must be one of " L.sort()
+ ", ".join(_syslog_facilities.keys())) raise ValueError("Syslog facility must be one of " + ", ".join(L))
return value return value
def syslog_handler(section): def syslog_handler(section):
...@@ -200,7 +200,7 @@ def smtp_handler(section): ...@@ -200,7 +200,7 @@ def smtp_handler(section):
inst.setFormatter(logging.Formatter(format, dateformat)) inst.setFormatter(logging.Formatter(format, dateformat))
inst.setLevel(level) inst.setLevel(level)
host, port = section.host host, port = section.smtp_server
if not port: if not port:
mailhost = host mailhost = host
else: else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment