|
|
@@ -198,11 +198,12 @@ func setNoticeFiles(
|
|
|
}
|
|
|
|
|
|
const (
|
|
|
- noticeIsDiagnostic = 1
|
|
|
- noticeIsHomepage = 2
|
|
|
- noticeClearHomepages = 4
|
|
|
- noticeSyncHomepages = 8
|
|
|
- noticeSkipRedaction = 16
|
|
|
+ noticeIsDiagnostic = 1
|
|
|
+ noticeIsHomepage = 2
|
|
|
+ noticeClearHomepages = 4
|
|
|
+ noticeSyncHomepages = 8
|
|
|
+ noticeSkipRedaction = 16
|
|
|
+ noticeIsNotDiagnostic = 32
|
|
|
)
|
|
|
|
|
|
// outputNotice encodes a notice in JSON and writes it to the output writer.
|
|
|
@@ -279,17 +280,22 @@ func (nl *noticeLogger) outputNotice(noticeType string, noticeFlags uint32, args
|
|
|
if nl.rotatingFile != nil {
|
|
|
|
|
|
if !skipWriter {
|
|
|
- skipWriter = (noticeFlags¬iceIsDiagnostic != 0)
|
|
|
+ // Skip writing to the host application if the notice is diagnostic
|
|
|
+ // and not explicitly marked as not diagnostic
|
|
|
+ skipWriter = (noticeFlags¬iceIsDiagnostic != 0) && (noticeFlags¬iceIsNotDiagnostic == 0)
|
|
|
}
|
|
|
|
|
|
if !skipRedaction {
|
|
|
+ // Only write to the rotating file if the notice is not explicitly marked as not diagnostic.
|
|
|
+ if noticeFlags¬iceIsNotDiagnostic == 0 {
|
|
|
|
|
|
- err := nl.outputNoticeToRotatingFile(output)
|
|
|
+ err := nl.outputNoticeToRotatingFile(output)
|
|
|
|
|
|
- if err != nil {
|
|
|
- output := makeNoticeInternalError(
|
|
|
- fmt.Sprintf("write rotating file failed: %s", err))
|
|
|
- nl.writer.Write(output)
|
|
|
+ if err != nil {
|
|
|
+ output := makeNoticeInternalError(
|
|
|
+ fmt.Sprintf("write rotating file failed: %s", err))
|
|
|
+ nl.writer.Write(output)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -839,10 +845,12 @@ func NoticeClientUpgradeDownloaded(filename string) {
|
|
|
// transferred since the last NoticeBytesTransferred. This is not a diagnostic
|
|
|
// notice: the user app has requested this notice with EmitBytesTransferred
|
|
|
// for functionality such as traffic display; and this frequent notice is not
|
|
|
-// intended to be included with feedback.
|
|
|
+// intended to be included with feedback. The noticeIsNotDiagnostic flag
|
|
|
+// ensures that these notices are emitted to the host application but not written
|
|
|
+// to the diagnostic file to avoid cluttering it with frequent updates.
|
|
|
func NoticeBytesTransferred(diagnosticID string, sent, received int64) {
|
|
|
singletonNoticeLogger.outputNotice(
|
|
|
- "BytesTransferred", 0,
|
|
|
+ "BytesTransferred", noticeIsNotDiagnostic,
|
|
|
"diagnosticID", diagnosticID,
|
|
|
"sent", sent,
|
|
|
"received", received)
|