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

Rework LoggingBackend and timestamps (#11) #163

Merged
merged 2 commits into from
Oct 30, 2024
Merged

Conversation

willkg
Copy link
Contributor

@willkg willkg commented Oct 29, 2024

This adds a new "timestamp_mode" which changes the behavior of the timestamp in the logged output.

  • "utc": inserts a UTC timestamp
  • "local": inserts a local timezone timestamp
  • anything: doesn't insert a timestamp at all

In the cases where I'm using Markus in a local dev environment for service development, the logging framework is already configured with a timestamp, so having Markus' LoggingBackend also include a timestamp is redundant and not wildly helpful. Thus I wanted to include a "no timestamp" option.

For when the user wants a timestamp, it seemed prudent to support both UTC and local timezone timestamps.

Also, timestamps are now emitted in isoformat.

Fixes #11.

@willkg willkg force-pushed the 11-logging-timestamp branch 2 times, most recently from 3938db9 to 85a4ddb Compare October 29, 2024 23:24
This adds a new "timestamp_mode" which changes the behavior of the
timestamp in the logged output.

* "utc": inserts a UTC timestamp
* "local": inserts a local timezone timestamp
* anything: doesn't insert a timestamp at all

In the cases where I'm using Markus in a local dev environment for
service development, the logging framework is already configured with a
timestamp, so having Markus' LoggingBackend also include a timestamp is
redundant and not wildly helpful. Thus I wanted to include a "no
timestamp" option.

For when the user wants a timestamp, it seemed prudent to support both
UTC and local timezone timestamps.

Also, timestamps are now emitted in isoformat.
@willkg willkg force-pushed the 11-logging-timestamp branch from 85a4ddb to f015254 Compare October 29, 2024 23:43
HISTORY.rst Outdated

No timestamp example::

LoggingBackend()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be LoggingMetrics?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops! Thank you for catching this!

@robhudson
Copy link
Contributor

I like the changes here...

  • ISO formatted timestamps 👍
  • Defaulting to no timestamps 👍 (locally I don't look at them so it's harder to parse)

@willkg willkg merged commit 1a3fbfd into main Oct 30, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

what timezone should LoggingMetrics use for timestamps?
2 participants