LogInfoPeriodically writes an unstructured log message with the INFO level but only periodically
(ctx context.Context, period *LogPeriod, msg string, v ...interface{})
| 261 | |
| 262 | // LogInfoPeriodically writes an unstructured log message with the INFO level but only periodically |
| 263 | func LogInfoPeriodically(ctx context.Context, period *LogPeriod, msg string, v ...interface{}) { |
| 264 | if !period.LastLog.IsZero() && time.Since(period.LastLog) < time.Duration(period.PeriodSecs)*time.Second { |
| 265 | return |
| 266 | } |
| 267 | logInfo(ctx, msg, v...) |
| 268 | period.LastLog = time.Now() |
| 269 | } |
| 270 | |
| 271 | // LogInfoBumpTrace bumps a trace interval |
| 272 | func LogInfoBumpTrace(prev *time.Time) (duration time.Duration) { |