Merge pull request #924 from bunyk/master

Add hook to send logs to custom writer #678
This commit is contained in:
Sébastien Lavoie
2020-02-26 17:31:00 -05:00
committed by GitHub
4 changed files with 116 additions and 1 deletions
+6 -1
View File
@@ -85,10 +85,15 @@ func NewEntry(logger *Logger) *Entry {
}
}
// Returns the bytes representation of this entry from the formatter.
func (entry *Entry) Bytes() ([]byte, error) {
return entry.Logger.Formatter.Format(entry)
}
// Returns the string representation from the reader and ultimately the
// formatter.
func (entry *Entry) String() (string, error) {
serialized, err := entry.Logger.Formatter.Format(entry)
serialized, err := entry.Bytes()
if err != nil {
return "", err
}