formatters logging basicconfig(format='%(asctime) [%(levelname) %(funcname) %(message) 'level=logging debugwhich will now generate the output within log level information and the function involved : : , [debugdo_somethingthis is to help with debugging : : , [infodo_somethingthis is just for information : : , [warningdo_somethingthis is warning : : , [errordo_somethingthis should be used with something unexpected : : , [criticaldo_somethingsomething serious we can even control the format of the date time information associated with the log statement using the datafmt parameter of the logging basicconfig(functionlogging basicconfig(format='%(asctime) %(message) 'datefmt='% /% /% % :% :% % 'level=logging debugthis format string uses the formatting options used by the datetime strptime(function (see % --month as zero-padded decimal number % --day of the month as zero-padded decimal number etc % --year with century as decimal number % --hour ( - clockas zero-padded decimal number etc % --minute as zero-padded decimal number etc % --second as zero-padded decimal number etc % --either am or pm thus the output generated using the above datefmt string is : : pm this is to help with debugging : : pm this is just for information : : pm this is warning : : pm this should be used with something unexpected : : pm something serious to set formatter on an individual handler see the next section