Esempio n. 1
0
// NewDefaultLogger creates a new DefaultLogger that is configured to write messages to console with minimum log level Level.
func NewDefaultLogger(Level LogLevel) *DefaultLogger {
	var config = fmt.Sprintf(`<seelog minlevel="%s">
    <outputs formatid="main">
        <console />
    </outputs>

    <formats>
        <format id="main" format="%%Date/%%Time [%%LEVEL] %%Msg%%n"/>
    </formats>
</seelog>`, Level)
	logger, _ := log.LoggerFromConfigAsBytes([]byte(config))
	return &DefaultLogger{logger}
}
Esempio n. 2
0
// NewConsoleLogger creates a new ConsoleLogger that is configured to write messages to console with given minimum log level
// and given message format.
func NewConsoleLogger(level LogLevel, format string) *ConsoleLogger {
	var config = fmt.Sprintf(`<seelog minlevel="%s">
    <outputs formatid="main">
        <console />
    </outputs>

    <formats>
        <format id="main" format="%s"/>
    </formats>
</seelog>`, level, format)
	logger, _ := log.LoggerFromConfigAsBytes([]byte(config))
	return &ConsoleLogger{logger}
}