package logs

import (
	"ColdVerify_server/conf"
	"github.com/astaxie/beego/logs"
)

var logx *logs.BeeLogger

func init() {
	logx = logs.NewLogger()
	logx.SetLogger(logs.AdapterFile, `{"filename":"logs/logx/logx.log"}`)
	logx.EnableFuncCallDepth(true)
	logx.SetLogFuncCallDepth(3)
	if conf.RunMode == "dev" {
		logx.SetLogger(logs.AdapterConsole)
	}
}

func Println(format string, v ...interface{}) {
	for _, _ = range v {
		format += " %v"
	}
	logx.Info(format, v...)
}

// Debug Log DEBUG level message.
func Debug(format string, v ...interface{}) {
	for _, _ = range v {
		format += " %v"
	}
	logx.Debug(format, v...)
}

// Info Log ERROR level message.
func Info(format string, v ...interface{}) {
	for _, _ = range v {
		format += " %v"
	}
	logx.Info(format, v...)
}

// Error Log ERROR level message.
func Error(format string, v ...interface{}) {
	for _, _ = range v {
		format += " %v"
	}

	logx.Error(format, v...)
}

// Warning Log WARNING level message.
func Warning(format string, v ...interface{}) {
	for _, _ = range v {
		format += " %v"
	}
	logx.Warning(format, v...)
}
