1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

improve log handling

This commit is contained in:
checktheroads
2020-10-11 15:39:15 -07:00
parent 70e39102b0
commit 95cd9424fd
4 changed files with 55 additions and 40 deletions

View File

@@ -37,29 +37,27 @@ POSSIBILITY OF SUCH DAMAGE.
"""
# Standard Library
import sys
import logging
# Third Party
import uvloop
import rich.traceback
# Project
from hyperglass.log import _get_rich
from hyperglass.util import set_app_path
from hyperglass.constants import METADATA
try:
# Third Party
import stackprinter
except ImportError:
pass
else:
if sys.stdout.isatty():
_style = "darkbg2"
else:
_style = "plaintext"
stackprinter.set_excepthook(style=_style)
# Use Rich for traceback formatting.
rich.traceback.install()
# Set Rich as the default logging handler.
logging.getLogger().handlers = [_get_rich(True)]
# Find hyperglass application directory.
set_app_path()
# Use Uvloop for performance.
uvloop.install()
__name__, __version__, __author__, __copyright__, __license__ = METADATA