Changeset 825 for pykota/trunk

Show
Ignore:
Timestamp:
02/28/03 00:48:41 (22 years ago)
Author:
jalet
Message:

Correctly maps PyKota's log levels to syslog log levels

Location:
pykota/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/edpykota

    r824 r825  
    1717# 
    1818# $Log$ 
     19# Revision 1.24  2003/02/27 23:48:41  jalet 
     20# Correctly maps PyKota's log levels to syslog log levels 
     21# 
    1922# Revision 1.23  2003/02/27 22:55:20  jalet 
    2023# WARN log priority doesn't exist. 
     
    212215        if (softlimit is not None) and (hardlimit is not None) and (hardlimit < softlimit) :         
    213216            # error, exchange them 
    214             self.logger.log_message(_("Hard limit %i is less than soft limit %i, values will be exchanged.") % (hardlimit, softlimit), "info") 
     217            self.logger.log_message(_("Hard limit %i is less than soft limit %i, values will be exchanged.") % (hardlimit, softlimit)) 
    215218            (softlimit, hardlimit) = (hardlimit, softlimit) 
    216219        if not names :     
  • pykota/trunk/bin/pykota

    r824 r825  
    1717# 
    1818# $Log$ 
     19# Revision 1.12  2003/02/27 23:48:41  jalet 
     20# Correctly maps PyKota's log levels to syslog log levels 
     21# 
    1922# Revision 1.11  2003/02/27 22:55:20  jalet 
    2023# WARN log priority doesn't exist. 
     
    121124    except PyKotaRequesterError, msg : 
    122125        # can't get actual page counter, assume printer is off, but warns in log 
    123         kotafilter.logger.log_message(msg, "err") 
     126        kotafilter.logger.log_message(msg, "warn") 
    124127        printerIsOff = 1 
    125128    else :     
     
    131134        # The printer is unknown from the Quota Storage perspective 
    132135        # we let the job pass through, but log a warning message 
    133         kotafilter.logger.log_message(_("Printer %s not registered in the PyKota system") % kotafilter.printername, "info") 
     136        kotafilter.logger.log_message(_("Printer %s not registered in the PyKota system") % kotafilter.printername) 
    134137    else :     
    135138        # get last values from Quota Storage 
  • pykota/trunk/pykota/loggers/system.py

    r824 r825  
    1515# 
    1616# $Log$ 
     17# Revision 1.4  2003/02/27 23:48:41  jalet 
     18# Correctly maps PyKota's log levels to syslog log levels 
     19# 
    1720# Revision 1.3  2003/02/27 22:55:20  jalet 
    1821# WARN log priority doesn't exist. 
     
    3235class Logger : 
    3336    """A logger class which logs to syslog.""" 
     37    levels = { "error" : "ERR", "warn": "WARNING", "info": "INFO", "debug": "DEBUG" } 
    3438    def __init__(self) : 
    3539        """Opens the logging subsystem.""" 
     
    4246    def log_message(self, message, level="info") : 
    4347        """Sends the message to syslog.""" 
    44         priority = getattr(syslog, "LOG_%s" % level.upper(), syslog.LOG_DEBUG) 
     48        priority = getattr(syslog, "LOG_%s" % self.levels.get(level.lower(), "DEBUG").upper(), syslog.LOG_DEBUG) 
    4549        syslog.syslog(priority, message) 
  • pykota/trunk/pykota/tool.py

    r824 r825  
    1515# 
    1616# $Log$ 
     17# Revision 1.24  2003/02/27 23:48:41  jalet 
     18# Correctly maps PyKota's log levels to syslog log levels 
     19# 
    1720# Revision 1.23  2003/02/27 22:55:20  jalet 
    1821# WARN log priority doesn't exist. 
     
    254257            else :     
    255258                action = "DENY" 
    256             self.logger.log_message(_("Unable to match user %s on printer %s, applying default policy (%s)") % (username, printername, action), "info") 
     259            self.logger.log_message(_("Unable to match user %s on printer %s, applying default policy (%s)") % (username, printername, action)) 
    257260            return (action, None, None) 
    258261        else :