Skip to content

Commit

Permalink
cant import Logger from loguru
Browse files Browse the repository at this point in the history
ImportError: cannot import name 'Logger' from 'loguru'
  • Loading branch information
johanlundberg committed Oct 7, 2024
1 parent 149a1d0 commit fcfed42
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/eduid/vccs/server/log.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import logging
import sys
from typing import TYPE_CHECKING

from loguru import Logger
from loguru import logger as loguru_logger

if TYPE_CHECKING:
import loguru


class InterceptHandler(logging.Handler):
def emit(self, record: logging.LogRecord) -> None:
Expand All @@ -23,7 +26,7 @@ def emit(self, record: logging.LogRecord) -> None:
loguru_logger.opt(depth=depth, exception=record.exc_info).log(level, record.getMessage())


def init_logging() -> Logger:
def init_logging() -> "loguru.Logger":
loguru_logger.remove()
fmt = (
"<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <7}</level> | <cyan>{module: <11}</cyan>:"
Expand Down

0 comments on commit fcfed42

Please sign in to comment.