Updated logging

This commit is contained in:
netbenix 2021-11-06 21:20:49 +01:00
parent ff9e4b3e3a
commit 4859b622a5
6 changed files with 13 additions and 12 deletions

View file

@ -6,7 +6,7 @@ import (
"os"
)
func CheckIfLogFolderExists(){
func checkIfLogFolderExists(){
_, dirErr := os.Stat("logs")
if dirErr != nil{
log.Fatal(dirErr)
@ -22,7 +22,13 @@ func CheckIfLogFolderExists(){
}
func CreateLogger(loggerName string, logLevel logrus.Level) *logrus.Logger{
var logger = createLogger(logrus.WarnLevel)
func Logger(section string) *logrus.Entry {
return logger.WithField("section", section)
}
func createLogger(logLevel logrus.Level) *logrus.Logger{
var logger = logrus.New()
logger.Formatter = new(logrus.TextFormatter)