You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/README.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -233,6 +233,14 @@ The InfoLogger library allows to inject messages directly from programs, as show
233
233
* InfoLogger library is also available for: Tcl, Python, Go, Node.js.
234
234
It allows to log message from scripting languages. A simplified subset of the InfoLogger C++ API is made available through SWIG-generated modules.
235
235
Details of the functions accessible from the scripting interface are provided in [a separate document](scriptingAPI.md).
236
+
237
+
* C++ API provides a mean to automatically control / reduce the verbosity of some log messages.
238
+
Auto-mute occurs when a defined amount of messages using the same token in a period of time is exceeded.
239
+
The token parameter defines the limits for this maximum verbosity (max messages + time interval), and keeps internal count of usage.
240
+
* the time interval starts on the first message, and is reset on the next message after an interval completed. (it is not equal to "X seconds before last message").
241
+
* when the number of messages counted in an interval exceeds the threshold, auto-mute triggers ON: next messages (with this token) are discarded.
242
+
* when auto-mute is ON, one message is still printed for each time interval, with statistics about the number of discarded messages. The logging rate is effectively limited to a couple of messages per interval.
243
+
* the auto-mute triggers OFF when there was no message received for a duration equal to the interval time. (this is equal to "X seconds before last message").
Copy file name to clipboardExpand all lines: doc/releaseNotes.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,3 +94,6 @@ This file describes the main feature changes for each InfoLogger released versio
94
94
95
95
## v2.0.1 - 05/05/2021
96
96
- fix reconnect timeout in stdout fallback mode (now 5s).
97
+
98
+
## v2.1.0 - 11/05/2021
99
+
- API: added auto-mute feature for potentially verbose/repetitive messages. To be enabled message per message, using an AutoMuteToken (c++ only, see InfoLogger.hxx and testInfoLogger.cxx).
InfoLogger::InfoLoggerMessageOption logOptions; // options used for associated logs
274
+
unsignedint maxMsg; // maximum number of messages for the selected time interval
275
+
unsignedint interval; // duration of interval (seconds)
276
+
std::atomic<unsignedint> count; // number of messages so far in interval
277
+
std::chrono::time_point<std::chrono::steady_clock> t0; // time of beginning of interval
278
+
std::chrono::time_point<std::chrono::steady_clock> t1; // time of previous message
279
+
unsignedint ndiscarded; // number of messages discarded in last interval
280
+
unsignedint ndiscardedtotal; // number of messages discarded since beginning of verbose phase
281
+
};
282
+
251
283
/// Convert a string to an infologger severity
252
284
/// \param text NUL-terminated word to convert to InfoLogger severity type. Current implementation is not exact-match, it takes closest based on first-letter value
253
285
/// \return Corresponding severity (InfoLogger::Undefined if no match found)
/// extended log function, with all extra fields, using default context
304
+
/// with automatic message muting, according to the usage of the token parameter provided.
305
+
/// Auto-mute occurs when defined amount of messages using same token in a period of time is exceeded.
306
+
/// The token parameter defines the limits for this maximum verbosity, and keeps internal count of usage.
307
+
/// The token should be the same variable used between consecutive calls for a given type of messages,
308
+
/// typically a static variable properly initialized with desired settings, close to the log call(s) to be controlled.
309
+
///
310
+
///
311
+
/// Auto-mute behavior is as follows:
312
+
/// - the time interval starts on the first message, and is reset on the next message after an interval completed. (it is not equal to "X seconds before last message").
313
+
/// - when the number of messages counted in an interval exceeds the threshold, auto-mute triggers ON: next messages (with this token) are discarded
314
+
/// - when auto-mute is on, one message is still printed for each time interval, with statistics about the number of discarded messages -> the logging rate is effectively limited to a couple of messages per interval
315
+
/// - the auto-mute triggers off when there was no message received for a duration equal to the interval time. (this is equal to "X seconds before last message").
316
+
///
317
+
/// \return 0 on success, an error code otherwise (but never throw exceptions).
0 commit comments