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
Hi, I am facing some confusion regarding the behavior of the Level field in the logrus.Entry struct.
Based on the documentation and examples, it seems that the Level field of an Entry is expected to represent the log level of the current log entry.
If I set the log level globally on a logrus.Logger instance, the Entry does not automatically inherit this level. Furthermore, when logging, logrus.Entry actually relies on the logrus.Logger's level to determine whether the log should be written. Does the Level field in logrus.Entry serve any other purpose, and should it be designed to stay synchronized with the logrus.Logger's level?
entry.go:
func NewEntry(logger *Logger) *Entry {
return &Entry{
Logger: logger,
// Default is three fields, plus one optional. Give a little extra room.
Data: make(Fields, 6),
}
}
func (entry *Entry) Log(level Level, args ...interface{}) {
if entry.Logger.IsLevelEnabled(level) {
entry.log(level, fmt.Sprint(args...))
}
}
The text was updated successfully, but these errors were encountered:
Hi, I am facing some confusion regarding the behavior of the Level field in the logrus.Entry struct.
Based on the documentation and examples, it seems that the Level field of an Entry is expected to represent the log level of the current log entry.
If I set the log level globally on a logrus.Logger instance, the Entry does not automatically inherit this level. Furthermore, when logging, logrus.Entry actually relies on the logrus.Logger's level to determine whether the log should be written. Does the Level field in logrus.Entry serve any other purpose, and should it be designed to stay synchronized with the logrus.Logger's level?
entry.go:
The text was updated successfully, but these errors were encountered: