Skip to content

Commit

Permalink
添加log字段serviceName
Browse files Browse the repository at this point in the history
  • Loading branch information
richie committed Jun 4, 2019
1 parent a9229ab commit 580abee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions pkg/api/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ func (handler *streamHandler) Read(p []byte) (size int, err error) {
if err = json.Unmarshal(msg.Data, &xtermMsg); err != nil {
return
}

// web ssh 调整了终端大小
if xtermMsg.MsgType == "resize" {
// 放到channel里, 等remotecommand executor 调用我们的Next取走
Expand All @@ -78,6 +79,7 @@ func (handler *streamHandler) Read(p []byte) (size int, err error) {
copy(p, xtermMsg.Input)

}

return

}
Expand Down
1 change: 1 addition & 0 deletions pkg/utils/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func GinRus(logger loggerEntryWithfields, timeFormat string, utc bool) gin.Handl
}

entry := logger.WithFields(logrus.Fields{
"serviceName": "k8s-webshell",
"status": c.Writer.Status(),
"method": c.Request.Method,
"path": requestPath,
Expand Down
3 changes: 1 addition & 2 deletions pkg/ws/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
)

var wsUpgrader = websocket.Upgrader{
ReadBufferSize: 16384,
ReadBufferSize: 16384,
WriteBufferSize: 16384,
// 允许所有CORS跨域访问
CheckOrigin: func(r *http.Request) bool {
Expand Down Expand Up @@ -55,7 +55,6 @@ func (wsConn *WsConnection) wsReadLoop() {
MessageType: msgType,
Data: data,
}

select {
case wsConn.inChan <- msg:
case <-wsConn.closeChan:
Expand Down

0 comments on commit 580abee

Please sign in to comment.