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
5 changes: 1 addition & 4 deletions src/fastcs/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,7 @@ def run(
help=f"A yaml file matching the {controller_class.__name__} schema"
),
],
log_level: Annotated[
Optional[LogLevel], # noqa: UP045
typer.Option(),
] = None,
log_level: Annotated[LogLevel, typer.Option()] = LogLevel.INFO,
graylog_endpoint: Annotated[
Optional[GraylogEndpoint], # noqa: UP045
typer.Option(
Expand Down
6 changes: 3 additions & 3 deletions src/fastcs/logging/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
drivers. This logger uses ``loguru`` as underlying logging library, which enables much
simpler configuration as well as structured logging.

Keyword arguments to log statments will be attached as extra fields on the log record.
Keyword arguments to log statements will be attached as extra fields on the log record.
These fields are displayed separately in the console output and can used for filtering
and metrics in graylog.

Expand Down Expand Up @@ -70,7 +70,7 @@ def bind_logger(logger_name: str) -> Logger:


def configure_logging(
level: LogLevel | None = None,
level: LogLevel = LogLevel.INFO,
graylog_endpoint: GraylogEndpoint | None = None,
graylog_static_fields: GraylogStaticFields | None = None,
graylog_env_fields: GraylogEnvFields | None = None,
Expand All @@ -95,7 +95,7 @@ def configure_logging(


# Configure logger with defaults - INFO level and disabled
configure_logging()
_configure_logger(logger)


class _StdLoggingInterceptHandler(logging.Handler):
Expand Down
3 changes: 3 additions & 0 deletions src/fastcs/logging/_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ def format_record(record) -> str:
else:
extras = ""

# Escape braces so Loguru doesn't parse them as format placeholders
extras = extras.replace("{", "{{").replace("}", "}}")

return f"""\
<level>[{time} {record["level"].name[0]}]</level> \
{record["message"]:<80} \
Expand Down