Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion docs/introduction/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ For FastStream you must provide additionally:

## Structlog

To bootstrap Structlog, you must set `service_debug` to False
To bootstrap Structlog, you must keep `logging_enabled` to True

Additional parameters:

Expand Down
5 changes: 3 additions & 2 deletions lite_bootstrap/instruments/logging_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def __call__(self, *args: typing.Any) -> logging.Logger: # noqa: ANN401

@dataclasses.dataclass(kw_only=True, frozen=True)
class LoggingConfig(BaseConfig):
logging_enabled: bool = True
logging_log_level: int = logging.INFO
logging_flush_level: int = logging.ERROR
logging_buffer_capacity: int = 10
Expand All @@ -95,11 +96,11 @@ class LoggingConfig(BaseConfig):
@dataclasses.dataclass(kw_only=True, slots=True, frozen=True)
class LoggingInstrument(BaseInstrument):
bootstrap_config: LoggingConfig
not_ready_message = "service_debug is True"
not_ready_message = "logging_enabled is False"
missing_dependency_message = "structlog is not installed"

def is_ready(self) -> bool:
return not self.bootstrap_config.service_debug and import_checker.is_structlog_installed
return self.bootstrap_config.logging_enabled and import_checker.is_structlog_installed

@staticmethod
def check_dependencies() -> bool:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_free_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_free_bootstrap(free_bootstrapper_config: FreeBootstrapperConfig) -> Non
def test_free_bootstrap_logging_not_ready(log_output: list[EventDict]) -> None:
FreeBootstrapper(
bootstrap_config=FreeBootstrapperConfig(
service_debug=True,
logging_enabled=False,
opentelemetry_endpoint="otl",
opentelemetry_instrumentors=[CustomInstrumentor()],
opentelemetry_span_exporter=ConsoleSpanExporter(),
Expand All @@ -43,7 +43,7 @@ def test_free_bootstrap_logging_not_ready(log_output: list[EventDict]) -> None:
),
)
assert log_output == [
{"event": "LoggingInstrument is not ready, because service_debug is True", "log_level": "info"}
{"event": "LoggingInstrument is not ready, because logging_enabled is False", "log_level": "info"}
]


Expand Down
Loading