You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
725 B
Go

// Package config -----------------------------
// @file : zapLog.go
// @author : JJXu
// @contact : wavingbear@163.com
// @time : 2024/7/2 上午11:14
// -------------------------------------------
package config
import (
"gopkg.in/ini.v1"
"log"
)
var Zap = zapConfig{}
type zapConfig struct {
Level string `ini:"level"`
Filename string `ini:"filename"`
MaxSize string `ini:"max_size"`
MaxAge string `ini:"max_age"`
MaxBackups string `ini:"max_backups"`
}
func (b *zapConfig) SectionName() string {
return "zap_log"
}
func (b *zapConfig) LoadConfig(file *ini.File) {
section := file.Section(b.SectionName())
err := section.MapTo(b)
if err != nil {
log.Println(err.Error())
}
}