Skip to content

style is not applied to datefmt in logging.Formatter #137985

@SelimV

Description

@SelimV

Documentation

The documentation for logging formatters states that the parameter datefmt is "[a] format string in the given style" and "[the parameter style] only applies to fmt and datefmt". However, in formatTime the time ct is formatted time.strftime(datefmt, ct), not with self._style.format like in formatMessage. This means, for example, that despite using style="{" I still need to format the timestamp with "%Y-%m-%d %H:%M:%S%z".

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    No status

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions