통합통계 로그 삭제

main
JungJun 2 years ago
parent 62cda2c212
commit 68ba2f89cb

@ -7,7 +7,6 @@ import (
"log"
"os"
"path/filepath"
"runtime/debug"
"strconv"
"strings"
"sync"
@ -251,9 +250,9 @@ func (s *IcsLog) DelLog() {
switch v := err.(type) {
case error:
icserror.ICSERRFileOpen.SetError(v)
s.Printf(LOG_LEVEL_WARN, -1, "PANIC! %s\n%s", icserror.ICSERRFileOpen.GetError().Error(), string(debug.Stack()))
// s.Printf(LOG_LEVEL_WARN, -1, "PANIC! %s\n%s", icserror.ICSERRFileOpen.GetError().Error(), string(debug.Stack()))
default:
s.Print(LOG_LEVEL_WARN, -1, icserror.ICSERRFileOpen.GetError().Error())
// s.Print(LOG_LEVEL_WARN, -1, icserror.ICSERRFileOpen.GetError().Error())
}
}
//derr = icserror.ICSERRFileOpen
@ -266,8 +265,8 @@ func (s *IcsLog) DelLog() {
files, rderr := ioutil.ReadDir(s.Path)
if rderr != nil {
s.Printf(LOG_LEVEL_ERROR, -1, " Read Log Dir error - %s \n", rderr)
fmt.Printf("Read Log Dir error - %s", rderr)
// s.Printf(LOG_LEVEL_ERROR, -1, " Read Log Dir error - %s \n", rderr)
// fmt.Printf("Read Log Dir error - %s", rderr)
} else {
var logYYYY, logMM, logDD string
for _, file := range files {
@ -281,8 +280,8 @@ func (s *IcsLog) DelLog() {
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))
if perr != nil {
s.Printf(LOG_LEVEL_ERROR, -1, " Log Time Parse error - %s \n", perr)
fmt.Printf("Log Time Parse error - %s", perr)
// s.Printf(LOG_LEVEL_ERROR, -1, " Log Time Parse error - %s \n", perr)
// fmt.Printf("Log Time Parse error - %s", perr)
} else {
diff := delTime.Sub(chgLogTime)
@ -290,16 +289,16 @@ func (s *IcsLog) DelLog() {
if diff > 0 {
delResult := icsutil.DeleteFile(s.Path, file.Name())
if delResult != "" {
s.Printf(LOG_LEVEL_ERROR, -1, " Delete File error - %s \n", delResult)
// s.Printf(LOG_LEVEL_ERROR, -1, " Delete File error - %s \n", delResult)
} else {
s.Printf(LOG_LEVEL_INFO, -1, " Delete %s!!!!\n", file.Name())
fmt.Printf("Delete %s!!!!\n", file.Name())
// s.Printf(LOG_LEVEL_INFO, -1, " Delete %s!!!!\n", file.Name())
// fmt.Printf("Delete %s!!!!\n", file.Name())
delLogCount += 1
}
}
}
}
}
s.Printf(LOG_LEVEL_INFO, -1, " Delete File Count - %d \n", delLogCount)
fmt.Printf("Log Delete Count : %d", delLogCount)
// s.Printf(LOG_LEVEL_INFO, -1, " Delete File Count - %d \n", delLogCount)
// fmt.Printf("Log Delete Count : %d", delLogCount)
}

@ -102,9 +102,9 @@ func main() {
//fmt.Printf("Service Started - %d\n================================\n", pid)
info = "\n" + info
icsLog.Print(icslog.LOG_LEVEL_INFO, -1, info)
icsLog.Print(icslog.LOG_LEVEL_INFO, -1, "Service Started")
icsLog.Print(icslog.LOG_LEVEL_INFO, -1, "================================")
// icsLog.Print(icslog.LOG_LEVEL_INFO, -1, info)
// icsLog.Print(icslog.LOG_LEVEL_INFO, -1, "Service Started")
// icsLog.Print(icslog.LOG_LEVEL_INFO, -1, "================================")
/////////////////////////////////
//icsutil.CloseSTDIO()

Loading…
Cancel
Save