Skip to content

Commit

Permalink
change sessionid to uuid-like format
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoaquim committed Mar 14, 2023
1 parent 0a15ec9 commit 2dd4d64
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions openbb_terminal/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
import sys
import time
import uuid
from pathlib import Path
from typing import Optional

Expand Down Expand Up @@ -47,8 +48,6 @@

logger = logging.getLogger(__name__)

START_TIMESTAMP = int(time.time())


def get_app_id() -> str:
"""UUID of the current installation."""
Expand All @@ -69,6 +68,12 @@ def get_app_id() -> str:
return app_id


def get_session_id() -> str:
"""UUID of the current session."""
session_id = str(uuid.uuid4()) + "-" + str(int(time.time()))
return session_id


def get_commit_hash(use_env=True) -> str:
"""Get Commit Short Hash"""

Expand Down Expand Up @@ -157,7 +162,6 @@ def setup_handlers(settings: Settings):
def setup_logging(
app_name: Optional[str] = None,
frequency: Optional[str] = None,
session_id: Optional[str] = None,
verbosity: Optional[int] = None,
) -> None:
"""Setup Logging"""
Expand All @@ -166,7 +170,7 @@ def setup_logging(
commit_hash = get_commit_hash()
name = app_name or LOGGING_APP_NAME
identifier = get_app_id()
session_id = session_id or str(START_TIMESTAMP)
session_id = get_session_id()
user_id = get_user_uuid()

# AWSSettings
Expand Down

0 comments on commit 2dd4d64

Please sign in to comment.