로그 제거

main
JungJun 2 years ago
parent 8cef94d4c6
commit dc1493d355

@ -5,7 +5,6 @@ import (
"gitlab.com/ics_cinnamon/voiceStatistics/icsconf" "gitlab.com/ics_cinnamon/voiceStatistics/icsconf"
"gitlab.com/ics_cinnamon/voiceStatistics/icserror" "gitlab.com/ics_cinnamon/voiceStatistics/icserror"
"gitlab.com/ics_cinnamon/voiceStatistics/icslog"
"gitlab.com/ics_cinnamon/voiceStatistics/icsnet" "gitlab.com/ics_cinnamon/voiceStatistics/icsnet"
"gitlab.com/ics_cinnamon/voiceStatistics/icsstat" "gitlab.com/ics_cinnamon/voiceStatistics/icsstat"
"gitlab.com/ics_cinnamon/voiceStatistics/icssvc" "gitlab.com/ics_cinnamon/voiceStatistics/icssvc"
@ -33,7 +32,7 @@ func Init(conf *icsconf.IcsConfig) (e *IcsExec) {
} }
func (exe IcsExec) Execute() *icserror.IcsError { func (exe IcsExec) Execute() *icserror.IcsError {
l := icslog.GetIcsLog() // l := icslog.GetIcsLog()
icsstat.NewSidVal() icsstat.NewSidVal()
for !exe.service.GetExit() { for !exe.service.GetExit() {
@ -73,13 +72,13 @@ func (exe IcsExec) Execute() *icserror.IcsError {
select { select {
case err := <-cmdDone: 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 { if err != nil {
//err.Print() //err.Print()
return err return err
} }
case err1 := <-cmdDone1: 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 { if err1 != nil {
//err.Print() //err.Print()
return err1 return err1

@ -1,8 +1,9 @@
package icsevent package icsevent
import ( import (
"fmt"
"gitlab.com/ics_cinnamon/voiceStatistics/icserror" "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 return -1, icserror.ICSERRInvalidParam
} }
l := icslog.GetIcsLog() // l := icslog.GetIcsLog()
var iter int = 0 var iter int = 0
for tmp := first; tmp != nil && tmp.tail != nil; tmp = tmp.tail { for tmp := first; tmp != nil && tmp.tail != nil; tmp = tmp.tail {
var id int var id int
@ -81,7 +82,8 @@ func GetLength(first *RRData) (int, *icserror.IcsError) {
id = v id = v
} }
p := h.getEvt(id) 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++ iter++
} }

@ -7,7 +7,6 @@ import (
"gitlab.com/ics_cinnamon/voiceStatistics/icsconf" "gitlab.com/ics_cinnamon/voiceStatistics/icsconf"
"gitlab.com/ics_cinnamon/voiceStatistics/icserror" "gitlab.com/ics_cinnamon/voiceStatistics/icserror"
"gitlab.com/ics_cinnamon/voiceStatistics/icslog"
) )
const ( const (
@ -242,10 +241,10 @@ func ListenAndServeTCP(laddr, raddr *IcsNetAddr, bufend string, f func(*IcsTCPNe
} }
//defer t.listener.Close() //defer t.listener.Close()
l := icslog.GetIcsLog() // l := icslog.GetIcsLog()
go func() { go func() {
//fmt.Printf("Started TCP Listen - %s\n", laddr.String()) //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 { for {
var conn *net.TCPConn var conn *net.TCPConn
@ -259,7 +258,7 @@ func ListenAndServeTCP(laddr, raddr *IcsNetAddr, bufend string, f func(*IcsTCPNe
// newT.SetLinger(1) // newT.SetLinger(1)
newT.SetLinger() newT.SetLinger()
newT.SetDeadline(180) 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(conn, bufend)
go f(newT, bufend) go f(newT, bufend)
} }

@ -92,7 +92,7 @@ const (
) )
func ListenStatMNG() (icserr *icserror.IcsError) { func ListenStatMNG() (icserr *icserror.IcsError) {
l := icslog.GetIcsLog() // l := icslog.GetIcsLog()
conf := icsconf.GetIcsConfig() conf := icsconf.GetIcsConfig()
//start bot-command listen //start bot-command listen
@ -104,17 +104,18 @@ func ListenStatMNG() (icserr *icserror.IcsError) {
var cmdErr *icserror.IcsError var cmdErr *icserror.IcsError
statTCP, cmdErr := icsnet.ListenAndServeTCP(&statLocalAddr, nil, "\r\n", StatsCommandVG) statTCP, cmdErr := icsnet.ListenAndServeTCP(&statLocalAddr, nil, "\r\n", StatsCommandVG)
if cmdErr != nil { 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 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) fmt.Println(statTCP)
return nil return nil
} }
func ListenStatMNG1() (icserr *icserror.IcsError) { func ListenStatMNG1() (icserr *icserror.IcsError) {
l := icslog.GetIcsLog() // l := icslog.GetIcsLog()
conf := icsconf.GetIcsConfig() conf := icsconf.GetIcsConfig()
//start bot-command listen //start bot-command listen
@ -126,10 +127,11 @@ func ListenStatMNG1() (icserr *icserror.IcsError) {
var cmdErr *icserror.IcsError var cmdErr *icserror.IcsError
statTCP, cmdErr := icsnet.ListenAndServeTCP(&statLocalAddr, nil, "\r\n", StatsCommandVA) statTCP, cmdErr := icsnet.ListenAndServeTCP(&statLocalAddr, nil, "\r\n", StatsCommandVA)
if cmdErr != nil { 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 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) fmt.Println(statTCP)
return nil return nil
@ -169,14 +171,14 @@ func StatsCommandVG(t *icsnet.IcsTCPNet, bufend string) {
defer t.Close() 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 { // for {
statReads, rlen, rerr := t.ReadS(10137, bufend) // 여기서 전체 몇 byte씩 읽어서 로그를 찍을건지 알아야함 statReads, rlen, rerr := t.ReadS(10137, bufend) // 여기서 전체 몇 byte씩 읽어서 로그를 찍을건지 알아야함
if rerr != nil { if rerr != nil {
if rerr.GetError() != io.EOF { if rerr.GetError() != io.EOF {
l.Printf(icslog.LOG_LEVEL_ERROR, -1, "[Stat Command] ReadS Error! - %s[%d:%d]", // l.Printf(icslog.LOG_LEVEL_ERROR, -1, "[Stat Command] ReadS Error! - %s[%d:%d]",
rerr.GetError(), rlen, len(statReads)) // rerr.GetError(), rlen, len(statReads))
return return
} }
} else { } else {
@ -271,14 +273,14 @@ func StatsCommandVA(t *icsnet.IcsTCPNet, bufend string) {
defer t.Close() 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 { // for {
statReads, rlen, rerr := t.ReadS(10137, bufend) // 여기서 전체 몇 byte씩 읽어서 로그를 찍을건지 알아야함 statReads, rlen, rerr := t.ReadS(10137, bufend) // 여기서 전체 몇 byte씩 읽어서 로그를 찍을건지 알아야함
if rerr != nil { if rerr != nil {
if rerr.GetError() != io.EOF { if rerr.GetError() != io.EOF {
l.Printf(icslog.LOG_LEVEL_ERROR, -1, "[Stat Command] ReadS Error! - %s[%d:%d]", // l.Printf(icslog.LOG_LEVEL_ERROR, -1, "[Stat Command] ReadS Error! - %s[%d:%d]",
rerr.GetError(), rlen, len(statReads)) // rerr.GetError(), rlen, len(statReads))
return return
} }
} else { } else {

Loading…
Cancel
Save