Skip to content

Use aware time object in processors.TimeStamper() #703

@andrei-korshikov

Description

@andrei-korshikov

At this moment %z, %:z and %Z time format codes are replaced by empty strings (see Note 6), because of:

# A naive local datetime is fine here, because we only format it.
return datetime.datetime.now() # noqa: DTZ005

Could you replace datetime.datetime.now() with datetime.datetime.now().astimezone()?

And, frankly, I disagree with the comment: I use aware time object here exactly because I format it (using %:z in my case).


Off-topic: thank you for attrs and structlog! And huuuge thanks for your articles—I've learned from your texts a lot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions