로그 삭제 value 설정

main
JungJun 2 years ago
parent 6546653bff
commit 059f4503e4

@ -50,8 +50,9 @@ type LogConfig struct {
} }
type DelConfig struct { type DelConfig struct {
DelDay int `xml:"day,attr"` DelDay int `xml:"day,attr"`
DelHour int `xml:"hour,attr"` DelHour int `xml:"hour,attr"`
Value bool `xml:"value,attr"`
} }
type RotateConfig struct { type RotateConfig struct {

@ -242,6 +242,10 @@ func GetLogOutputID(str string) int {
} }
func (s *IcsLog) DelLog() { func (s *IcsLog) DelLog() {
conf := icsconf.GetIcsConfig()
if !conf.LogConfig.DelConfig.Value {
return
}
//var derr *icserror.IcsError = nil //var derr *icserror.IcsError = nil
delLogCount := 0 delLogCount := 0
@ -276,9 +280,9 @@ func (s *IcsLog) DelLog() {
2. - 2. -
3. 0 3. 0
*/ */
logTime := strings.SplitN(file.Name(), "-", -1)[1] logTime := strings.SplitN(file.Name(), ".", -1)[1]
logYYYY, logMM, logDD = logTime[:4], logTime[4:6], logTime[6:8] logYYYY, logMM, logDD = logTime[:4], logTime[4:6], logTime[6:8]
chgLogTime, perr := time.Parse("2006-01-02", fmt.Sprintf("%s-%s-%s", logYYYY, logMM, logDD)) chgLogTime, perr := time.Parse("2006-01-02", fmt.Sprintf("%s%s%s", logYYYY, logMM, logDD))
if perr != nil { if perr != nil {
// s.Printf(LOG_LEVEL_ERROR, -1, " Log Time Parse error - %s \n", perr) // s.Printf(LOG_LEVEL_ERROR, -1, " Log Time Parse error - %s \n", perr)
// fmt.Printf("Log Time Parse error - %s", perr) // fmt.Printf("Log Time Parse error - %s", perr)

Loading…
Cancel
Save