Nyew in vewsion 0.6.0.
Setting Up WoggingΒΆ
disnyake w-w-wogs ewwows and debug infowmation via the logging python
moduwe. It is s-stwongwy wecommended that the w-wogging moduwe is
configuwed, as nyo ewwows ow wawnyings wiww be output if it is nyot set up.
Configuwation of the logging moduwe can be as simpwe as:
import logging
logging.basicConfig(level=logging.INFO)
Pwaced at the stawt of the appwication. This wiww output the wogs fwom
disnyake as weww as othew wibwawies t-that u-use the logging moduwe
diwectwy to the consowe.
The optionyaw level awgument specifies what wevew of events to wog
out and can be any o-of CRITICAL, ERROR, WARNING, INFO, and
DEBUG and if n-n-nyot specified defauwts to WARNING.
Mowe advanced setups a-a-awe possibwe with the logging moduwe. F-F-Fow
exampwe to wwite the wogs to a fiwe cawwed disnake.log instead of
outputting them to the consowe the fowwowing snyippet can be used:
import disnake
import logging
logger = logging.getLogger('disnake')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename='disnake.log', encoding='utf-8', mode='w')
handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s'))
logger.addHandler(handler)
This is w-w-wecommended, especiawwy at vewbose wevews such as INFO
and DEBUG, as thewe awe a-a-a wot of events wogged and it wouwd cwog the
stdout of youw pwogwam.
Fow mowe infowmation, check the documentation and tutowiaw of the
logging moduwe.