Exemple #1
0
// NewPrefixedLogger creates new instance of pluggable logger using specified
// prefix.
func NewPrefixedLogger(prefix string) lorg.Logger {
	if prefix != "" {
		prefix += " "
	}

	format := lorg.NewFormat(logFormatting)
	format.SetPlaceholder("prefix", func(_ lorg.Level, _ string) string {
		return prefix
	})

	logger := lorg.NewLog()
	logger.SetFormat(format)

	return logger
}
Exemple #2
0
func init() {
	format := lorg.NewFormat(logFormatString)
	logger.SetFormat(format)
}