Esempio n. 1
0
File: init.go Progetto: dolab/gogo
func init() {
	var err error

	// setup logger
	stderr, err = logger.New("stderr")
	if err != nil {
		panic(err.Error())
	}

	stderr.SetLevelByName("info")
	stderr.SetFlag(log.Lshortfile)
}
Esempio n. 2
0
func NewAppLogger(output, filename string) *AppLogger {
	switch output {
	case "stdout", "stderr", "null", "nil":
		// skip
	default:
		if output[0] != '/' {
			output = path.Join(output, filename+".log")
		}
	}

	l, err := logger.New(output)
	if err != nil {
		log.Println("Cannot create logger:", err)

		return nil
	}

	return &AppLogger{l, ""}
}
Esempio n. 3
0
File: logger.go Progetto: dolab/gogo
func NewAppLogger(output, filename string) *AppLogger {
	switch output {
	case "stdout", "stderr", "null", "nil":
		// skip

	default:
		if output[0] != '/' {
			output = path.Join(output, filename+".log")
		}
	}

	l, err := logger.New(output)
	if err != nil {
		log.Printf("logger.New(%s): %v\n", output, err)

		return nil
	}

	logger := &AppLogger{l, ""}
	return logger
}