[Tutor] Extending logging module

Kent Johnson kent37 at tds.net
Thu Aug 9 21:26:26 CEST 2007


jay wrote:
> I have a working solution for this, based largely on what Kent posted.  
> Thought I would post it for others in case your either curious, or need 
> to do this in the future.  There are probably other ways to do this.
> 
> To add a new level NOTICE for logging to syslog
> 
>     # Change the default levels to include NOTICE in
>     # the proper order of priority
>     logging.FATAL = logging.CRITICAL = 60
>     logging.ERROR = 50
>     logging.WARN = logging.WARNING = 40
>     logging.NOTICE = 30
> 
>     # insert the levels with all the redefined values
>     # anything below NOTICE we don't have to add back in, its
>     # not getting redefined above with a new value
>     logging.addLevelName(logging.NOTICE , 'NOTICE')
>     logging.addLevelName(logging.WARNING, 'WARNING')
>     logging.addLevelName(logging.WARN, 'WARN')
>     logging.addLevelName(logging.ERROR, 'ERROR')
>     logging.addLevelName (logging.FATAL, 'FATAL')
>     logging.addLevelName(logging.CRITICAL, 'CRITICAL')

Are you sure you have to move FATAL, ERROR and WARN? Did you try NOTICE 
= 25?

Kent


More information about the Tutor mailing list