github.com/adacta-ru/mattermost-server/v6@v6.0.0/mlog/errors.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See LICENSE.txt for license information. 3 4 package mlog 5 6 import "github.com/mattermost/logr" 7 8 // onLoggerError is called when the logging system encounters an error, 9 // such as a target not able to write records. The targets will keep trying 10 // however the error will be logged with a dedicated level that can be output 11 // to a safe/always available target for monitoring or alerting. 12 func onLoggerError(err error) { 13 Log(LvlLogError, "advanced logging error", Err(err)) 14 } 15 16 // onQueueFull is called when the main logger queue is full, indicating the 17 // volume and frequency of log record creation is too high for the queue size 18 // and/or the target latencies. 19 func onQueueFull(rec *logr.LogRec, maxQueueSize int) bool { 20 Log(LvlLogError, "main queue full, dropping record", Any("rec", rec)) 21 return true // drop record 22 } 23 24 // onTargetQueueFull is called when the main logger queue is full, indicating the 25 // volume and frequency of log record creation is too high for the target's queue size 26 // and/or the target latency. 27 func onTargetQueueFull(target logr.Target, rec *logr.LogRec, maxQueueSize int) bool { 28 Log(LvlLogError, "target queue full, dropping record", String("target", ""), Any("rec", rec)) 29 return true // drop record 30 }