/* {{{ func (mux *Mux) Accessor() config.LoggerContainer * */ func (mux *Mux) Accessor() (*logs.OLogger, error) { if mux.accessor == nil { // init logger logger := logs.NewLogger(204600) var err error err = logger.SetLogger("access", fmt.Sprintf(`{"filename":"%s"}`, mux.env.AccessPath)) if err != nil { return nil, err } mux.accessor = logger } return mux.accessor, nil }
/* {{{ func (mux *Mux) Logger() config.LoggerContainer * */ func (mux *Mux) Logger() (*logs.OLogger, error) { if mux.logger == nil { // init logger logger := logs.NewLogger(204600) var err error if mux.env.Daemonize { err = logger.SetLogger("file", `{"filename":"logs/debug.log"}`) } else { err = logger.SetLogger("console", "") } if err != nil { return nil, err } logger.EnableFuncCallDepth(true) logger.SetLogFuncCallDepth(4) logger.SetLevel(mux.env.DebugLevel) mux.logger = logger } return mux.logger, nil }