Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the logging params for usage #19

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions fixcloudutils/logging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import logging
import os
from logging import StreamHandler, basicConfig
from typing import Optional, List, Dict
from typing import Optional, List, Dict, Callable

from .json_logger import JsonFormatter
from .prometheus_counter import PrometheusLoggingCounter
Expand All @@ -39,6 +39,7 @@ def setup_logger(
count_logs: bool = True,
log_format: Optional[str] = None,
json_format_dict: Optional[Dict[str, str]] = None,
get_logging_context: Optional[Callable[[], Dict[str, str]]] = None
) -> List[StreamHandler]: # type: ignore
log_level = level or logging.INFO
# override log output via env var
Expand All @@ -53,7 +54,7 @@ def setup_logger(
"pid": "process",
"thread": "threadName",
}
formatter = JsonFormatter(format_dict, static_values={"component": component})
formatter = JsonFormatter(format_dict, static_values={"component": component}, get_logging_context=get_logging_context)
handler.setFormatter(formatter)
basicConfig(handlers=[handler], force=force, level=log_level)
else:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "fixcloudutils"
version = "1.9.0"
version = "1.10.0"
authors = [{ name = "Some Engineering Inc." }]
description = "Utilities for fixcloud."
license = { file = "LICENSE" }
Expand Down
Loading