From d9f014a19f8c56f9a9ec562155147ee8995bd198 Mon Sep 17 00:00:00 2001 From: teh_coderer Date: Fri, 2 Jun 2023 15:01:52 -0400 Subject: [PATCH 1/2] set user profile on identify --- .../core/log/generation/settings_logger.py | 19 +++++++++---------- openbb_terminal/loggers.py | 3 +++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/openbb_terminal/core/log/generation/settings_logger.py b/openbb_terminal/core/log/generation/settings_logger.py index 0d2f60e6d5b3..0dc00527ea7a 100644 --- a/openbb_terminal/core/log/generation/settings_logger.py +++ b/openbb_terminal/core/log/generation/settings_logger.py @@ -68,13 +68,12 @@ def log_preferences() -> None: def log_startup() -> None: """Combined logging of all settings""" - logger.info( - "STARTUP: %s ", - json.dumps( - { - "PREFERENCES": get_current_user().preferences.to_dict(), - "KEYS": get_credentials(), - "SYSTEM": get_system(), - } - ), - ) + logger.info("STARTUP: %s ", json.dumps(get_startup())) + + +def get_startup(): + return { + "PREFERENCES": get_current_user().preferences.to_dict(), + "KEYS": get_credentials(), + "SYSTEM": get_system(), + } diff --git a/openbb_terminal/loggers.py b/openbb_terminal/loggers.py index e4a8c37596ca..59edb9dee24e 100644 --- a/openbb_terminal/loggers.py +++ b/openbb_terminal/loggers.py @@ -12,6 +12,8 @@ from platform import platform, python_version from typing import Any, Dict, Optional +from openbb_terminal.core.log.generation.settings_logger import get_startup + # IMPORTATION THIRDPARTY try: import git @@ -188,6 +190,7 @@ def send(self, record: logging.LogRecord): { "email": get_current_user().profile.email, "primaryUsage": get_current_user().profile.primary_usage, + **get_startup(), }, ) openbb_posthog.alias(get_user_uuid(), app_settings.identifier) From 6682ce2735b002bbcfa6a5ed9dfc95e5d39983b7 Mon Sep 17 00:00:00 2001 From: teh_coderer Date: Fri, 2 Jun 2023 15:57:49 -0400 Subject: [PATCH 2/2] Update loggers.py --- openbb_terminal/loggers.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openbb_terminal/loggers.py b/openbb_terminal/loggers.py index 59edb9dee24e..111c6c9959b2 100644 --- a/openbb_terminal/loggers.py +++ b/openbb_terminal/loggers.py @@ -12,8 +12,6 @@ from platform import platform, python_version from typing import Any, Dict, Optional -from openbb_terminal.core.log.generation.settings_logger import get_startup - # IMPORTATION THIRDPARTY try: import git @@ -37,6 +35,7 @@ LogSettings, Settings, ) +from openbb_terminal.core.log.generation.settings_logger import get_startup from openbb_terminal.core.log.generation.user_logger import ( NO_USER_PLACEHOLDER, get_current_user,