From dc1493d3553d6d739a3024b984c18f03d0f36236 Mon Sep 17 00:00:00 2001 From: JungJun Date: Tue, 19 Jul 2022 14:59:20 +0900 Subject: [PATCH] =?UTF-8?q?=EB=A1=9C=EA=B7=B8=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- icsapp/execsvc.go | 7 +++---- icsevent/datastruct.go | 8 +++++--- icsnet/icstcp.go | 7 +++---- icsstat/icsstat.go | 26 ++++++++++++++------------ 4 files changed, 25 insertions(+), 23 deletions(-) diff --git a/icsapp/execsvc.go b/icsapp/execsvc.go index bb62089..487e517 100644 --- a/icsapp/execsvc.go +++ b/icsapp/execsvc.go @@ -5,7 +5,6 @@ import ( "gitlab.com/ics_cinnamon/voiceStatistics/icsconf" "gitlab.com/ics_cinnamon/voiceStatistics/icserror" - "gitlab.com/ics_cinnamon/voiceStatistics/icslog" "gitlab.com/ics_cinnamon/voiceStatistics/icsnet" "gitlab.com/ics_cinnamon/voiceStatistics/icsstat" "gitlab.com/ics_cinnamon/voiceStatistics/icssvc" @@ -33,7 +32,7 @@ func Init(conf *icsconf.IcsConfig) (e *IcsExec) { } func (exe IcsExec) Execute() *icserror.IcsError { - l := icslog.GetIcsLog() + // l := icslog.GetIcsLog() icsstat.NewSidVal() for !exe.service.GetExit() { @@ -73,13 +72,13 @@ func (exe IcsExec) Execute() *icserror.IcsError { select { case err := <-cmdDone: - l.Printf(icslog.LOG_LEVEL_INFO, -1, "Closed Gateway Stat TCP Connection: %s", err) + // l.Printf(icslog.LOG_LEVEL_INFO, -1, "Closed Gateway Stat TCP Connection: %s", err) if err != nil { //err.Print() return err } case err1 := <-cmdDone1: - l.Printf(icslog.LOG_LEVEL_INFO, -1, "Closed Agent Stat TCP Connection: %s", err1) + // l.Printf(icslog.LOG_LEVEL_INFO, -1, "Closed Agent Stat TCP Connection: %s", err1) if err1 != nil { //err.Print() return err1 diff --git a/icsevent/datastruct.go b/icsevent/datastruct.go index 8dab0c3..24b2a8a 100644 --- a/icsevent/datastruct.go +++ b/icsevent/datastruct.go @@ -1,8 +1,9 @@ package icsevent import ( + "fmt" + "gitlab.com/ics_cinnamon/voiceStatistics/icserror" - "gitlab.com/ics_cinnamon/voiceStatistics/icslog" ) //////////////////////////////////////////////////////////////////// @@ -71,7 +72,7 @@ func GetLength(first *RRData) (int, *icserror.IcsError) { return -1, icserror.ICSERRInvalidParam } - l := icslog.GetIcsLog() + // l := icslog.GetIcsLog() var iter int = 0 for tmp := first; tmp != nil && tmp.tail != nil; tmp = tmp.tail { var id int @@ -81,7 +82,8 @@ func GetLength(first *RRData) (int, *icserror.IcsError) { id = v } p := h.getEvt(id) - l.Printf(icslog.LOG_LEVEL_DEBUG2, -1, "GetLength(%d)>%d-%v tmp>%p-%p", iter, id, p, tmp, tmp.tail) + fmt.Printf("GetLength(%d)>%d-%v tmp>%p-%p", iter, id, p, tmp, tmp.tail) + // l.Printf(icslog.LOG_LEVEL_DEBUG2, -1, "GetLength(%d)>%d-%v tmp>%p-%p", iter, id, p, tmp, tmp.tail) iter++ } diff --git a/icsnet/icstcp.go b/icsnet/icstcp.go index aad400c..0bf42ac 100644 --- a/icsnet/icstcp.go +++ b/icsnet/icstcp.go @@ -7,7 +7,6 @@ import ( "gitlab.com/ics_cinnamon/voiceStatistics/icsconf" "gitlab.com/ics_cinnamon/voiceStatistics/icserror" - "gitlab.com/ics_cinnamon/voiceStatistics/icslog" ) const ( @@ -242,10 +241,10 @@ func ListenAndServeTCP(laddr, raddr *IcsNetAddr, bufend string, f func(*IcsTCPNe } //defer t.listener.Close() - l := icslog.GetIcsLog() + // l := icslog.GetIcsLog() go func() { //fmt.Printf("Started TCP Listen - %s\n", laddr.String()) - l.Printf(icslog.LOG_LEVEL_INFO, -1, "Started TCP Listen - %s", laddr.String()) + // l.Printf(icslog.LOG_LEVEL_INFO, -1, "Started TCP Listen - %s", laddr.String()) for { var conn *net.TCPConn @@ -259,7 +258,7 @@ func ListenAndServeTCP(laddr, raddr *IcsNetAddr, bufend string, f func(*IcsTCPNe // newT.SetLinger(1) newT.SetLinger() newT.SetDeadline(180) - l.Printf(icslog.LOG_LEVEL_DEBUG, -1, "Connected - [%s][%s]", conn.LocalAddr(), conn.RemoteAddr()) + // l.Printf(icslog.LOG_LEVEL_DEBUG, -1, "Connected - [%s][%s]", conn.LocalAddr(), conn.RemoteAddr()) //go f(conn, bufend) go f(newT, bufend) } diff --git a/icsstat/icsstat.go b/icsstat/icsstat.go index dcbbaf3..040fa3c 100644 --- a/icsstat/icsstat.go +++ b/icsstat/icsstat.go @@ -92,7 +92,7 @@ const ( ) func ListenStatMNG() (icserr *icserror.IcsError) { - l := icslog.GetIcsLog() + // l := icslog.GetIcsLog() conf := icsconf.GetIcsConfig() //start bot-command listen @@ -104,17 +104,18 @@ func ListenStatMNG() (icserr *icserror.IcsError) { var cmdErr *icserror.IcsError statTCP, cmdErr := icsnet.ListenAndServeTCP(&statLocalAddr, nil, "\r\n", StatsCommandVG) if cmdErr != nil { - l.Printf(icslog.LOG_LEVEL_FATAL, -1, "%s", cmdErr.GetError()) + // l.Printf(icslog.LOG_LEVEL_FATAL, -1, "%s", cmdErr.GetError()) return nil } - l.Printf(icslog.LOG_LEVEL_INFO, -1, "Listening Stat TCP Command %s port[%d]", statTransport, statPort) + fmt.Printf("Listening Stat TCP Command %s port[%d]", statTransport, statPort) + // l.Printf(icslog.LOG_LEVEL_INFO, -1, "Listening Stat TCP Command %s port[%d]", statTransport, statPort) fmt.Println(statTCP) return nil } func ListenStatMNG1() (icserr *icserror.IcsError) { - l := icslog.GetIcsLog() + // l := icslog.GetIcsLog() conf := icsconf.GetIcsConfig() //start bot-command listen @@ -126,10 +127,11 @@ func ListenStatMNG1() (icserr *icserror.IcsError) { var cmdErr *icserror.IcsError statTCP, cmdErr := icsnet.ListenAndServeTCP(&statLocalAddr, nil, "\r\n", StatsCommandVA) if cmdErr != nil { - l.Printf(icslog.LOG_LEVEL_FATAL, -1, "%s", cmdErr.GetError()) + // l.Printf(icslog.LOG_LEVEL_FATAL, -1, "%s", cmdErr.GetError()) return nil } - l.Printf(icslog.LOG_LEVEL_INFO, -1, "Listening Stat TCP Command %s port[%d]", statTransport, statPort) + fmt.Printf("Listening Stat TCP Command %s port[%d]", statTransport, statPort) + // l.Printf(icslog.LOG_LEVEL_INFO, -1, "Listening Stat TCP Command %s port[%d]", statTransport, statPort) fmt.Println(statTCP) return nil @@ -169,14 +171,14 @@ func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) { defer t.Close() - l.Printf(icslog.LOG_LEVEL_INFO, -1, "Connected from - %s", t.RemoteAddr()) + // l.Printf(icslog.LOG_LEVEL_INFO, -1, "Connected from - %s", t.RemoteAddr()) // for { statReads, rlen, rerr := t.ReadS(10137, bufend) // 여기서 전체 몇 byte씩 읽어서 로그를 찍을건지 알아야함 if rerr != nil { if rerr.GetError() != io.EOF { - l.Printf(icslog.LOG_LEVEL_ERROR, -1, "[Stat Command] ReadS Error! - %s[%d:%d]", - rerr.GetError(), rlen, len(statReads)) + // l.Printf(icslog.LOG_LEVEL_ERROR, -1, "[Stat Command] ReadS Error! - %s[%d:%d]", + // rerr.GetError(), rlen, len(statReads)) return } } else { @@ -271,14 +273,14 @@ func StatsCommandVA(t *icsnet.IcsTCPNet, bufend string) { defer t.Close() - l.Printf(icslog.LOG_LEVEL_INFO, -1, "Connected from - %s", t.RemoteAddr()) + // l.Printf(icslog.LOG_LEVEL_INFO, -1, "Connected from - %s", t.RemoteAddr()) // for { statReads, rlen, rerr := t.ReadS(10137, bufend) // 여기서 전체 몇 byte씩 읽어서 로그를 찍을건지 알아야함 if rerr != nil { if rerr.GetError() != io.EOF { - l.Printf(icslog.LOG_LEVEL_ERROR, -1, "[Stat Command] ReadS Error! - %s[%d:%d]", - rerr.GetError(), rlen, len(statReads)) + // l.Printf(icslog.LOG_LEVEL_ERROR, -1, "[Stat Command] ReadS Error! - %s[%d:%d]", + // rerr.GetError(), rlen, len(statReads)) return } } else {