filtering log messages each logger object log has an internal level and filtering mechanism that determines which log messages get handled the following two methods are used to perform simple filtering based on the numeric level of log messageslog setlevel(levelsets the level of log only logging messages with level greater than or equal to level will be handled all other messages are simply ignored by defaultthe level is logging notset which processes all log messages log isenabledfor(levelreturns true if logging message at level level would be processed logging messages can also be filtered based on information associated with the message itself--for examplethe filenamethe line numberand other details the following methods are used for thislog addfilter(filtadds filter objectfiltto the logger log removefilter(filtremoves filter objectfiltfrom the logger in both methodsfilt is an instance of filter object filter(lognamecreates filter that only allows log messages from logname or its children to pass through for exampleif logname is 'app'then messages from loggers such as 'app''app net'or 'app userwill passbut messages from logger such as 'spamwill not custom filters can be created by subclassing filter and implementing the method filter(recordthat receives as input record containing information about logging message as outputtrue or false is returned depending on whether or not the message should be handled the record object passed to this method typically has the following attributesattribute description record name record levelname record levelno record pathname record filename record module record exc_info record lineno record funcname record created record thread record threadname record process logger name level name level number pathname of the module base filename module name exception information line number where log message was issued function name where log message was issued time at which issued thread identifier thread name pid of currently executing process lib fl ff