Changeset 825 for pykota/trunk
- Timestamp:
- 02/28/03 00:48:41 (22 years ago)
- Location:
- pykota/trunk
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/edpykota
r824 r825 17 17 # 18 18 # $Log$ 19 # Revision 1.24 2003/02/27 23:48:41 jalet 20 # Correctly maps PyKota's log levels to syslog log levels 21 # 19 22 # Revision 1.23 2003/02/27 22:55:20 jalet 20 23 # WARN log priority doesn't exist. … … 212 215 if (softlimit is not None) and (hardlimit is not None) and (hardlimit < softlimit) : 213 216 # 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)) 215 218 (softlimit, hardlimit) = (hardlimit, softlimit) 216 219 if not names : -
pykota/trunk/bin/pykota
r824 r825 17 17 # 18 18 # $Log$ 19 # Revision 1.12 2003/02/27 23:48:41 jalet 20 # Correctly maps PyKota's log levels to syslog log levels 21 # 19 22 # Revision 1.11 2003/02/27 22:55:20 jalet 20 23 # WARN log priority doesn't exist. … … 121 124 except PyKotaRequesterError, msg : 122 125 # 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") 124 127 printerIsOff = 1 125 128 else : … … 131 134 # The printer is unknown from the Quota Storage perspective 132 135 # 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) 134 137 else : 135 138 # get last values from Quota Storage -
pykota/trunk/pykota/loggers/system.py
r824 r825 15 15 # 16 16 # $Log$ 17 # Revision 1.4 2003/02/27 23:48:41 jalet 18 # Correctly maps PyKota's log levels to syslog log levels 19 # 17 20 # Revision 1.3 2003/02/27 22:55:20 jalet 18 21 # WARN log priority doesn't exist. … … 32 35 class Logger : 33 36 """A logger class which logs to syslog.""" 37 levels = { "error" : "ERR", "warn": "WARNING", "info": "INFO", "debug": "DEBUG" } 34 38 def __init__(self) : 35 39 """Opens the logging subsystem.""" … … 42 46 def log_message(self, message, level="info") : 43 47 """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) 45 49 syslog.syslog(priority, message) -
pykota/trunk/pykota/tool.py
r824 r825 15 15 # 16 16 # $Log$ 17 # Revision 1.24 2003/02/27 23:48:41 jalet 18 # Correctly maps PyKota's log levels to syslog log levels 19 # 17 20 # Revision 1.23 2003/02/27 22:55:20 jalet 18 21 # WARN log priority doesn't exist. … … 254 257 else : 255 258 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)) 257 260 return (action, None, None) 258 261 else :