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) }
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, ""} }
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 }