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

Why not add something like FB_LOG_EVERY_MS into glog? #884

Closed
GOGOYAO opened this issue Dec 21, 2022 · 2 comments
Closed

Why not add something like FB_LOG_EVERY_MS into glog? #884

GOGOYAO opened this issue Dec 21, 2022 · 2 comments

Comments

@GOGOYAO
Copy link

GOGOYAO commented Dec 21, 2022

Somtimes, it is more usefull to log every n ms. It is available in folly, why not support it in glog.

@Mivekk
Copy link

Mivekk commented Jan 7, 2024

It is supported in glog!
You should use LOG_EVERY_T

Here is an example with std::chrono_literals:

using namespace std::chrono_literals;
LOG_EVERY_T(INFO, 123ms) << "Hello!";

If you don't want to use std::chrono_literals you can express duration as a fraction of a second:
LOG_EVERY_T(INFO, 0.123) << "Hello!";

@sergiud
Copy link
Collaborator

sergiud commented Jan 7, 2024

@Mivekk Thanks.

Indeed, this feature has been already implemented in #669 and is available since glog 0.6.0.

@sergiud sergiud closed this as completed Jan 7, 2024
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

No branches or pull requests

3 participants