From b27d7370436366d5d99693e81efc6337e2a88f98 Mon Sep 17 00:00:00 2001 From: Henrique Joaquim Date: Mon, 24 Oct 2022 12:32:11 +0100 Subject: [PATCH] SDK to be logged as config parameter (#3011) * Add a parameter to indicate we are logging from the SDK as config instead of an app name * improve docstring to mention the source --- openbb_terminal/config_terminal.py | 2 ++ openbb_terminal/core/log/generation/settings.py | 2 +- openbb_terminal/sdk.py | 4 +++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/openbb_terminal/config_terminal.py b/openbb_terminal/config_terminal.py index 33636403802..cdced128d62 100644 --- a/openbb_terminal/config_terminal.py +++ b/openbb_terminal/config_terminal.py @@ -62,6 +62,8 @@ LOGGING_ROLLING_CLOCK = bool( # DEBUG = 10 # NOTSET = 0 LOGGING_VERBOSITY = int(os.getenv("OPENBB_LOGGING_VERBOSITY") or 20) +# LOGGING SUB APP +LOGGING_SUB_APP = os.getenv("OPENBB_LOGGING_SUB_APP") or "terminal" # API Keys section diff --git a/openbb_terminal/core/log/generation/settings.py b/openbb_terminal/core/log/generation/settings.py index b6be673391d..2c448674675 100644 --- a/openbb_terminal/core/log/generation/settings.py +++ b/openbb_terminal/core/log/generation/settings.py @@ -51,7 +51,7 @@ class AppSettings: ): """ Args: - name (str): Name of the application. + name (str): Source of the application. commit_hash (str): Commit hash of the current running code. identifier (str): Unique key identifying a particular installation. session_id (str): Key identifying a particular running session. diff --git a/openbb_terminal/sdk.py b/openbb_terminal/sdk.py index 52ba5b6b503..08b95048956 100644 --- a/openbb_terminal/sdk.py +++ b/openbb_terminal/sdk.py @@ -11,6 +11,7 @@ from typing import Optional, Callable, List import logging from traceback import format_stack +import openbb_terminal.config_terminal as cfg from openbb_terminal.rich_config import console from openbb_terminal.reports.reports_controller import ReportController from openbb_terminal.dashboards.dashboards_controller import DashboardsController @@ -2380,7 +2381,8 @@ class Loader: @staticmethod def __initialize_logging(): - setup_logging(app_name="gst_sdk") + cfg.LOGGING_SUB_APP = "sdk" + setup_logging() log_all_settings() @classmethod