From 059f4503e471cd024cbfdcd69236244c55ce234b Mon Sep 17 00:00:00 2001 From: JungJun Date: Wed, 27 Jul 2022 10:50:19 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=82=AD=EC=A0=9C=20value?= =?UTF-8?q?=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- icsconf/icsconf.go | 5 +++-- icslog/icslog.go | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/icsconf/icsconf.go b/icsconf/icsconf.go index 645d321..8e974ce 100644 --- a/icsconf/icsconf.go +++ b/icsconf/icsconf.go @@ -50,8 +50,9 @@ type LogConfig struct { } type DelConfig struct { - DelDay int `xml:"day,attr"` - DelHour int `xml:"hour,attr"` + DelDay int `xml:"day,attr"` + DelHour int `xml:"hour,attr"` + Value bool `xml:"value,attr"` } type RotateConfig struct { diff --git a/icslog/icslog.go b/icslog/icslog.go index 62c0aa2..f4d03b9 100644 --- a/icslog/icslog.go +++ b/icslog/icslog.go @@ -242,6 +242,10 @@ func GetLogOutputID(str string) int { } func (s *IcsLog) DelLog() { + conf := icsconf.GetIcsConfig() + if !conf.LogConfig.DelConfig.Value { + return + } //var derr *icserror.IcsError = nil delLogCount := 0 @@ -276,9 +280,9 @@ func (s *IcsLog) DelLog() { 2. 현재 시간 - 삭제기간 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] - 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 { // s.Printf(LOG_LEVEL_ERROR, -1, " Log Time Parse error - %s \n", perr) // fmt.Printf("Log Time Parse error - %s", perr)