Commit 6a9b7e49 authored by Fred Drake's avatar Fred Drake

In HandlerFactory and subclasses, use more reasonable method names.

parent b7fcba1e
...@@ -85,19 +85,20 @@ class HandlerFactory(Factory): ...@@ -85,19 +85,20 @@ class HandlerFactory(Factory):
Factory.__init__(self) Factory.__init__(self)
self.section = section self.section = section
def create_logger(self): def create_loghandler(self):
raise NotImplementedError("subclasses must override create_logger()") raise NotImplementedError(
"subclasses must override create_loghandler()")
def create(self): def create(self):
import logging import logging
logger = self.create_logger() logger = self.create_loghandler()
logger.setFormatter(logging.Formatter(self.section.format, logger.setFormatter(logging.Formatter(self.section.format,
self.section.dateformat)) self.section.dateformat))
logger.setLevel(self.section.level) logger.setLevel(self.section.level)
return logger return logger
class FileHandlerFactory(HandlerFactory): class FileHandlerFactory(HandlerFactory):
def create_logger(self): def create_loghandler(self):
from zLOG.LogHandlers import StreamHandler, FileHandler from zLOG.LogHandlers import StreamHandler, FileHandler
path = self.section.path path = self.section.path
if path == "STDERR": if path == "STDERR":
...@@ -138,13 +139,13 @@ def syslog_facility(value): ...@@ -138,13 +139,13 @@ def syslog_facility(value):
return value return value
class SyslogHandlerFactory(HandlerFactory): class SyslogHandlerFactory(HandlerFactory):
def create_logger(self): def create_loghandler(self):
from zLOG.LogHandlers import SysLogHandler from zLOG.LogHandlers import SysLogHandler
return SysLogHandler(self.section.address.address, return SysLogHandler(self.section.address.address,
self.section.facility) self.section.facility)
class Win32EventLogFactory(HandlerFactory): class Win32EventLogFactory(HandlerFactory):
def create_logger(self): def create_loghandler(self):
from zLOG.LogHandlers import Win32EventLogHandler from zLOG.LogHandlers import Win32EventLogHandler
return Win32EventLogHandler(self.section.appname) return Win32EventLogHandler(self.section.appname)
...@@ -177,13 +178,13 @@ def get_or_post(value): ...@@ -177,13 +178,13 @@ def get_or_post(value):
return value return value
class HTTPHandlerFactory(HandlerFactory): class HTTPHandlerFactory(HandlerFactory):
def create_logger(self): def create_loghandler(self):
from zLOG.LogHandlers import HTTPHandler from zLOG.LogHandlers import HTTPHandler
host, selector = self.section.url host, selector = self.section.url
return HTTPHandler(host, selector, self.section.method) return HTTPHandler(host, selector, self.section.method)
class SMTPHandlerFactory(HandlerFactory): class SMTPHandlerFactory(HandlerFactory):
def create_logger(self): def create_loghandler(self):
from zLOG.LogHandlers import SMTPHandler from zLOG.LogHandlers import SMTPHandler
host, port = self.section.smtp_server host, port = self.section.smtp_server
if not port: if not port:
......
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