Exemplo n.º 1
0
Arquivo: log.go Projeto: JREAMLU/gogs
func NewLogger(bufLen int64, mode, config string) {
	Mode, Config = mode, config
	logger = logs.NewLogger(bufLen)
	logger.EnableFuncCallDepth(true)
	logger.SetLogFuncCallDepth(4)
	logger.SetLogger(mode, config)
}
Exemplo n.º 2
0
func NewLogger(bufLen int64, mode, config string) {
	logger := logs.NewLogger(bufLen)

	isExist := false
	for _, l := range loggers {
		if l.Adapter == mode {
			isExist = true
			l = logger
		}
	}
	if !isExist {
		loggers = append(loggers, logger)
	}
	logger.SetLogFuncCallDepth(3)
	logger.SetLogger(mode, config)
}
Exemplo n.º 3
0
func NewLogger(bufLen int64, mode, config string) {
	logger := logs.NewLogger(bufLen)

	isExist := false
	for _, l := range loggers {
		if l.Adapter == mode {
			isExist = true
			l = logger
		}
	}
	if !isExist {
		loggers = append(loggers, logger)
	}
	logger.SetLogFuncCallDepth(3)
	if err := logger.SetLogger(mode, config); err != nil {
		Fatal("Fail to set logger(%s): %v", mode, err)
	}
}
Exemplo n.º 4
0
func NewLogger(bufLen int64, mode, config string) {
	logger = logs.NewLogger(bufLen)
	logger.SetLogger(mode, config)
}
Exemplo n.º 5
0
func init() {
	logger = logs.NewLogger(10000)
	logger.SetLogger("console", `{"level": 0}`)
}
Exemplo n.º 6
0
func NewGitLogger(logPath string) {
	os.MkdirAll(path.Dir(logPath), os.ModePerm)
	GitLogger = logs.NewLogger(0)
	GitLogger.SetLogger("file", fmt.Sprintf(`{"level":0,"filename":"%s","rotate":false}`, logPath))
}