[Zope-CVS] CVS: Packages/SFTPGateway/src/sftpgateway -
application.py:1.12 main.py:1.5 schema.xml:1.5
Fred L. Drake, Jr.
fred at zope.com
Fri Jan 2 18:30:21 EST 2004
Update of /cvs-repository/Packages/SFTPGateway/src/sftpgateway
In directory cvs.zope.org:/tmp/cvs-serv2019
Modified Files:
application.py main.py schema.xml
Log Message:
integrate the logger configuration
=== Packages/SFTPGateway/src/sftpgateway/application.py 1.11 => 1.12 ===
--- Packages/SFTPGateway/src/sftpgateway/application.py:1.11 Sun Dec 21 10:46:59 2003
+++ Packages/SFTPGateway/src/sftpgateway/application.py Fri Jan 2 18:30:20 2004
@@ -29,12 +29,7 @@
class Application:
def __init__(self, options):
- self.logger = logging.getLogger("sftpgateway")
- self.logger.setLevel(logging.DEBUG)
- handler = logging.StreamHandler()
- handler.setFormatter(
- logging.Formatter("%(asctime)s %(name)s %(message)s"))
- self.logger.addHandler(handler)
+ self.logger = options.logger
log.startLogging(log.NullFile())
self.options = options
self.portal = authentication.createPortal()
@@ -54,7 +49,7 @@
return 0
def get_child_logger(self, name):
- name = "sftpgateway." + name
+ name = "%s.%s" % (self.logger.name, name)
count = self._child_logger_info.get(name, 0)
count += 1
self._child_logger_info[name] = count
=== Packages/SFTPGateway/src/sftpgateway/main.py 1.4 => 1.5 ===
--- Packages/SFTPGateway/src/sftpgateway/main.py:1.4 Tue Dec 23 15:39:48 2003
+++ Packages/SFTPGateway/src/sftpgateway/main.py Fri Jan 2 18:30:20 2004
@@ -13,6 +13,7 @@
"""Main control script for SFTP Gateway."""
+import logging
import os
import sys
@@ -22,6 +23,7 @@
class SFTPGatewayOptions(ZDOptions):
schemadir = os.path.dirname(os.path.abspath(__file__))
+ logsectionname = "eventlog"
def realize(self, arglist, *args, **kw):
ZDOptions.realize(self, arglist, doc=__doc__, *args, **kw)
@@ -36,6 +38,20 @@
if not pubkeyfn:
pubkeyfn = self.private_host_key + ".pub"
self.public_host_key = pubkeyfn
+ #
+ if self.config_logger is None:
+ # no configured logger; create a reasonable default:
+ logger = logging.getLogger("sftpgateway")
+ logger.setLevel(logging.DEBUG)
+ handler = logging.StreamHandler()
+ handler.setFormatter(
+ logging.Formatter("%(asctime)s %(name)s %(message)s"))
+ logger.addHandler(handler)
+ else:
+ # use the configured logger:
+ self.config_logger.startup()
+ logger = self.config_logger()
+ self.logger = logger
def __getattr__(self, name):
return getattr(self.configroot.gateway, name)
=== Packages/SFTPGateway/src/sftpgateway/schema.xml 1.4 => 1.5 ===
--- Packages/SFTPGateway/src/sftpgateway/schema.xml:1.4 Tue Dec 23 15:39:48 2003
+++ Packages/SFTPGateway/src/sftpgateway/schema.xml Fri Jan 2 18:30:20 2004
@@ -1,10 +1,17 @@
<schema>
+
+ <import package="ZConfig.components.logger"/>
<import package="sftpgateway"/>
<section name="*"
type="sftp-gateway"
attribute="gateway"
required="yes"
+ />
+
+ <section name="*"
+ type="ZConfig.logger.log"
+ attribute="eventlog"
/>
<multikey name="path"
More information about the Zope-CVS
mailing list