controlling the amount of information logged this will now output all the log messages as debug is the lowest logging level we can of course turn off logging by setting the log level to notset logger setlevel(logging notsetalternatively you can set the loggers disabled attribute to truelogging logger disabled true logger methods the logger class provides number of methods that can be used to control what is logged includingsetlevel(levelsets this loggers log level geteffectivelevel(returns this loggers log level isenabledfor(levelchecks to see if this logger is enabled for the log level specified debug(messagelogs messages at the debug level info(messagelogs messages at the info level warning(messagelogs messages at the warning level error(messagelogs messages at the error level critical(messagelogs messages at the critical level exception(messagethis method logs message at the error level howeverit can only be used within an exception handler and includes stack trace of any associated exceptionfor exampleimport logging logger logging getlogger(tryprint('starting' print(xexceptlogger exception('an exception message'print('done'log(levelmessagelogs messages at the log level specified as the first parameter