root / pykota / trunk / pykota / loggers / stderr.py @ 3413

Revision 3413, 1.5 kB (checked in by jerome, 16 years ago)

Removed unnecessary spaces at EOL.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[3411]1# -*- coding: utf-8 -*-*-
[695]2#
[3260]3# PyKota : Print Quotas for CUPS
[695]4#
[3275]5# (c) 2003, 2004, 2005, 2006, 2007, 2008 Jerome Alet <alet@librelogiciel.com>
[3260]6# This program is free software: you can redistribute it and/or modify
[873]7# it under the terms of the GNU General Public License as published by
[3260]8# the Free Software Foundation, either version 3 of the License, or
[873]9# (at your option) any later version.
[3413]10#
[873]11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
[3413]15#
[873]16# You should have received a copy of the GNU General Public License
[3260]17# along with this program.  If not, see <http://www.gnu.org/licenses/>.
[695]18#
19# $Id$
20#
[1493]21#
[695]22
[2859]23"""This module defines a class for PyKota logging through stderr."""
24
[695]25import sys
[1457]26import os
[695]27
[2859]28__revision__ = "$Id$"
29
[695]30class Logger :
31    """A logger class which logs to stderr."""
32    def log_message(self, message, level="info") :
33        """Sends the message to the appropriate logging subsystem."""
[1493]34        try :
[2859]35            sys.stderr.write("%s: PyKota (PID %s) : %s\n" \
36                                              % (level.upper(), \
37                                                 os.getpid(), \
38                                                 message.strip()))
[3413]39        except IOError :
[1493]40            pass # What else could we do ?
[3413]41        else :
[1493]42            try :
43                sys.stderr.flush()
[3413]44            except IOError :
[1493]45                pass # What else could we do ?
Note: See TracBrowser for help on using the browser.