logging: add new RateLimiter helper class
Summary:
Add a new RateLimiter API to the logging library, to support rate limiting
messages in the future. I have included a single IntervalRateLimiter
implementation in this diff. In the future we can add more implementations if
necessary, to mimic the functionality available with our older logging code, to
make it easier for users to convert to the new framework.
Note that RateLimiter is inside a `folly::logging` namespace, unlike most of
the other code in the logging library that lives directly in the `folly`
namespace. I intentionally chose this since RateLimiter is a fairly generic
class name, and I wanted to distinguish it from other possible generic class
names in folly. On the other hand, most of the other class names already start
with `Log`, so there seems to be no need to put them in a `logging` namespace.
Nothing is using this new API yet, but I will use it for some internal logging
APIs in an upcoming diff. Later on I also plan to use it to implement
per-LogCategory rate limiting, and possibly per-LogHandler rate limiting.
Reviewed By: wez
Differential Revision:
D5162805
fbshipit-source-id:
9b81c2f4544006cd392152a768296bce0c5daaa1