Skip to content

Commit

Permalink
fix logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed Nov 21, 2024
1 parent b92ed7c commit a987863
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 20 deletions.
2 changes: 1 addition & 1 deletion konduktor/dashboard/backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from .sockets import socketio as sio

logger = konduktor_logging.get_logger2(__name__)
logger = konduktor_logging.get_logger(__name__)

# FastAPI app
app = FastAPI()
Expand Down
3 changes: 1 addition & 2 deletions konduktor/dashboard/backend/sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
cors_allowed_origins="*", ping_interval=25, ping_timeout=60, async_mode="asgi"
)

# logger = logging.getLogger(__name__)
logger = konduktor_logging.get_logger2(__name__)
logger = logging.getLogger(__name__)

# Global variables
CLIENT_CONNECTED = False
Expand Down
17 changes: 1 addition & 16 deletions konduktor/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,9 @@ def format(self, record):


def get_logger(name: str):
logger = logging.getLogger(name)
if not logger.hasHandlers(): # Check if the logger already has handlers
logger.setLevel(logging.DEBUG)
ch = logging.StreamHandler()
ch.setLevel(logging.INFO)
ch.setFormatter(FORMATTER)
logger.addHandler(ch)
logger.propagate = False
return logger


"""Logger with KONDUKTOR_DEBUG specific logic"""


def get_logger2(name: str):
# Determine the logging level based on the KONDUKTOR_DEBUG environment variable
log_level = logging.INFO
if os.environ.get("KONDUKTOR_DEBUG") in [None, "1"]:
if os.environ.get("KONDUKTOR_DEBUG", None) == "1":
log_level = logging.DEBUG

# Configure the logger
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors = ["Andrew Aikawa <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.10"
python = "^3.9"
colorama = "^0.4.6"
kubernetes = "^30.1.0"
click = "^8.1.7"
Expand Down

0 comments on commit a987863

Please sign in to comment.