MCPcopy
hub / github.com/1Panel-dev/KubePi / logHandler

Function logHandler

pkg/logging/logging.go:83–106  ·  view source on GitHub ↗
(session sockjs.Session)

Source from the content-addressed store, hash-verified

81}
82
83func logHandler(session sockjs.Session) {
84
85 var (
86 buf string
87 err error
88 msg LogMessage
89 logSession LogSession
90 )
91 if buf, err = session.Recv(); err != nil {
92 log.Printf("handleLogSession: can't Recv: %v", err)
93 return
94 }
95 if err = json.Unmarshal([]byte(buf), &msg); err != nil {
96 log.Printf("handleLogSession: can't UnMarshal (%v): %s", err, buf)
97 return
98 }
99 if logSession = LogSessions.Get(msg.SessionID); logSession.Id == "" {
100 log.Printf("handleLogSession: can't find session '%s'", msg.SessionID)
101 return
102 }
103 logSession.sockJSSession = session
104 LogSessions.Set(msg.SessionID, logSession)
105 logSession.Bound <- nil
106}
107
108func WaitForLoggingStream(k8sClient kubernetes.Interface, namespace string, pod string, container string, tailLines int, follow bool, previous bool , timestamps bool,sessionId string) {
109 select {

Callers

nothing calls this directly

Calls 2

GetMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected