##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""
A logging module which handles ZServer access log messages.

This depends on Vinay Sajip's PEP 282 logging module.
"""
import logging
from zLOG.BaseLogger import BaseLogger

class AccessLogger(BaseLogger):
    logger = logging.getLogger('access')
    def log(self, message):
        if not self.logger.handlers: # dont log if we have no handlers
            return
        if message.endswith('\n'):
            message = message[:-1]
        self.logger.warn(message)

access_logger = AccessLogger()
