-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* fixes bug #1853 * cleanup tests, warning, log and adds start banner in webserver
- Loading branch information
Showing
22 changed files
with
327 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 12 additions & 1 deletion
13
services/web/server/src/simcore_service_webserver/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
from .__version__ import __version__ | ||
import warnings | ||
|
||
from ._meta import __version__ | ||
|
||
# | ||
# NOTE: Some BaseSettings are using aliases (e.g. version for vtag) to facility construct | ||
# pydantic settings from names defined in trafaret schemas for the config files | ||
# | ||
warnings.filterwarnings( | ||
"ignore", | ||
message='aliases are no longer used by BaseSettings to define which environment variables to read. Instead use the "env" field setting. See https://pydantic-docs.helpmanual.io/usage/settings/#environment-variable-names', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
""" Configuration and utilities for service logging | ||
""" | ||
import logging | ||
import os | ||
from typing import Union | ||
|
||
from aiodebug import log_slow_callbacks | ||
from aiohttp.log import access_logger | ||
|
||
from servicelib.logging_utils import set_logging_handler | ||
|
||
LOG_LEVEL_STEP = logging.CRITICAL - logging.ERROR | ||
|
||
|
||
def setup_logging(*, level: Union[str, int]): | ||
# service log level | ||
logging.basicConfig(level=level) | ||
|
||
# root | ||
logging.root.setLevel(level) | ||
set_logging_handler(logging.root) | ||
|
||
# aiohttp access log-levels | ||
access_logger.setLevel(level) | ||
|
||
# keep mostly quiet noisy loggers | ||
quiet_level: int = max(min(logging.root.level + LOG_LEVEL_STEP, logging.CRITICAL), logging.WARNING) | ||
logging.getLogger("engineio").setLevel(quiet_level) | ||
logging.getLogger("openapi_spec_validator").setLevel(quiet_level) | ||
logging.getLogger("sqlalchemy").setLevel(quiet_level) | ||
logging.getLogger("sqlalchemy.engine").setLevel(quiet_level) | ||
|
||
# NOTE: Every task blocking > AIODEBUG_SLOW_DURATION_SECS secs is considered slow and logged as warning | ||
slow_duration = float(os.environ.get("AIODEBUG_SLOW_DURATION_SECS", 0.1)) | ||
log_slow_callbacks.enable(slow_duration) | ||
|
||
|
||
def test_logger_propagation(logger: logging.Logger): | ||
msg = f"TESTING %s log with {logger}" | ||
logger.critical(msg, "critical") | ||
logger.error(msg, "error") | ||
logger.info(msg, "info") | ||
logger.warning(msg, "warning") | ||
logger.debug(msg, "debug") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.