Exemple #1
0
// InitLogToStdout sets logging output to stdout (console)
func InitLogToStdout(env string) {
	if env == "dev" {
		colog.SetMinLevel(colog.LDebug)
	} else if env == "stage" {
		colog.SetMinLevel(colog.LInfo)
	}
	colog.SetOutput(os.Stdout)
}
Exemple #2
0
// InitLogToFile sets logging error output to file (warning level or above)
func InitLogToFile(errorlog string) {
	colog.SetMinLevel(colog.LWarning)
	colog.SetOutput(&lumberjack.Logger{
		Filename:   errorlog,
		MaxSize:    500, // megabytes
		MaxBackups: 3,
		MaxAge:     14, //days
	})
}