I'm using pyppeteer to take screenshots of images to a make a pdf but pyppeteer auto logs everything I take a screenshot at and because of server limitations and the logs is written to a file the logs are crashing my server.
Is there any way to completely disable logging? I tried this already:
'logLevel': logging.NOTSET,
'env': {'DEBUG': 'puppeteer:*,-not_this'},
I also tried to disable logging like this:
logging.getLogger('pyppeteer').setLevel(logging.NOTSET)
And nothing seems to work.
I managed to found a workaround although not a solution by disabling all logging in the application like this:
logging.disable(logging.CRITICAL)
# pyppeteer code...
logging.disable(logging.NOTSET)
Try this:
logging.getLogger("<logger name>").disabled = True
If you want to disable all loggers you can use:
for name in logging.root.manager.loggerDict:
# print("logger", name)
logging.getLogger(name).disabled = True
Or maybe if you want to disable all except some loggers you created:
allowed_loggers = ['some_logger']
for name in logging.root.manager.loggerDict:
# print("logger", name)
if name in allowed_loggers:
continue
logging.getLogger(name).disabled = True