Skip to content

Commit

Permalink
Add LOG_WARNING_ONCE
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed May 11, 2023
1 parent 8f4274d commit 69bf81a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/workerd/util/sentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ inline kj::StringPtr maybeOmitColoFromSentry(uint32_t coloId) {
KJ_LOG(severity, __VA_ARGS__); \
}

// Log this to Sentry once ever per process. Typically will be better to use LOG_ERROR_PERIODICALLY.
#define LOG_WARNING_ONCE(...) \
do { \
static bool logOnce KJ_UNUSED = [&]() { \
KJ_LOG(WARNING, __VA_ARGS__); \
return true; \
}(); \
} while (0)

// Log this to Sentry once ever per process. Typically will be better to use LOG_ERROR_PERIODICALLY.
#define LOG_ERROR_ONCE(...) \
do { \
Expand Down

0 comments on commit 69bf81a

Please sign in to comment.