Output the log using the logger because anything is fine with Python
The following three elements are required to output the minimum log
If you want to output it for the time being, this is spell-like.
Output for the time being
from logging import getLogger, StreamHandler, DEBUG
def main():
logger = getLogger(__name__) #Get a logger
handler = StreamHandler() #handler(StreamHandler)Get
handler.setLevel(DEBUG) #Set the output level of the handler
logger.setLevel(DEBUG) #Set the output level of the logger
logger.addHandler(handler) #Add handler to logger
logger.debug("It's a log ~") #Output log at debug level using logger
if __name__ == '__main__':
main()
Recommended Posts