mirror of
https://github.com/rjNemo/fastapi
synced 2026-06-11 04:56:41 +00:00
✨ Use a logger instead of the root logging (#222)
This commit is contained in:
parent
0e99b23ebc
commit
f541d2c200
1 changed files with 3 additions and 1 deletions
|
|
@ -5,13 +5,15 @@ from typing import Any, Dict, List, Optional, Union
|
||||||
from pydantic import BaseModel, Schema as PSchema
|
from pydantic import BaseModel, Schema as PSchema
|
||||||
from pydantic.types import UrlStr
|
from pydantic.types import UrlStr
|
||||||
|
|
||||||
|
logger = logging.getLogger("fastapi")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import email_validator
|
import email_validator
|
||||||
|
|
||||||
assert email_validator # make autoflake ignore the unused import
|
assert email_validator # make autoflake ignore the unused import
|
||||||
from pydantic.types import EmailStr # type: ignore
|
from pydantic.types import EmailStr # type: ignore
|
||||||
except ImportError: # pragma: no cover
|
except ImportError: # pragma: no cover
|
||||||
logging.warning(
|
logger.warning(
|
||||||
"email-validator not installed, email fields will be treated as str.\n"
|
"email-validator not installed, email fields will be treated as str.\n"
|
||||||
+ "To install, run: pip install email-validator"
|
+ "To install, run: pip install email-validator"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue