go-log/internal_logger_prefix.go

24 lines
367 B
Go
Raw Normal View History

2021-02-05 01:19:59 +00:00
package flog
import (
"strings"
)
func (receiver internalLogger) Prefix(newprefix ...string) Logger {
var buffer strings.Builder
buffer.WriteString(receiver.prefix)
for _, s := range newprefix {
buffer.WriteString(s)
buffer.WriteString(": ")
}
prefix := buffer.String()
var logger internalLogger = receiver
logger.prefix += prefix
return logger
}