Enable logging of nio errors

This commit is contained in:
miruka 2019-09-06 14:05:47 -04:00
parent f5cbbd0a44
commit fd0cd35152

View File

@ -1,6 +1,7 @@
import asyncio import asyncio
import logging as log import logging as log
import signal import signal
import sys
from concurrent.futures import Future from concurrent.futures import Future
from operator import attrgetter from operator import attrgetter
from threading import Thread from threading import Thread
@ -8,10 +9,14 @@ from typing import Coroutine, Sequence
from appdirs import AppDirs from appdirs import AppDirs
import nio
from . import __about__, pyotherside from . import __about__, pyotherside
from .pyotherside_events import CoroutineDone from .pyotherside_events import CoroutineDone
log.getLogger().setLevel(log.INFO) log.getLogger().setLevel(log.INFO)
nio.logger_group.level = nio.log.logbook.ERROR
nio.log.logbook.StreamHandler(sys.stderr).push_application()
try: try:
import uvloop import uvloop
@ -47,6 +52,7 @@ class App:
def set_debug(self, enable: bool, verbose: bool = False) -> None: def set_debug(self, enable: bool, verbose: bool = False) -> None:
if verbose: if verbose:
log.getLogger().setLevel(log.DEBUG) log.getLogger().setLevel(log.DEBUG)
nio.logger_group.level = nio.log.logbook.DEBUGG
if enable: if enable:
log.info("Debug mode enabled.") log.info("Debug mode enabled.")