package logs

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

var Logx *logs.BeeLogger

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

func Println(format string, v ...interface{}) {
	for _, _ = range v {
		format += " %v"
	}
	Logx.Info(format, v...)
	fmt.Println(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...)
}
