mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
🎨 logging
This commit is contained in:
parent
8658f3edfc
commit
156fc97c54
1 changed files with 11 additions and 11 deletions
|
|
@ -373,11 +373,11 @@ func serveWebSocket(ginServer *gin.Engine) {
|
||||||
})
|
})
|
||||||
|
|
||||||
util.WebSocketServer.HandlePong(func(session *melody.Session) {
|
util.WebSocketServer.HandlePong(func(session *melody.Session) {
|
||||||
//logging.LogInfof("pong")
|
logging.LogInfof("pong")
|
||||||
})
|
})
|
||||||
|
|
||||||
util.WebSocketServer.HandleConnect(func(s *melody.Session) {
|
util.WebSocketServer.HandleConnect(func(s *melody.Session) {
|
||||||
//logging.LogInfof("ws check auth for [%s]", s.Request.RequestURI)
|
logging.LogInfof("ws check auth for [%s]", s.Request.RequestURI)
|
||||||
authOk := true
|
authOk := true
|
||||||
|
|
||||||
if "" != model.Conf.AccessAuthCode {
|
if "" != model.Conf.AccessAuthCode {
|
||||||
|
|
@ -410,29 +410,29 @@ func serveWebSocket(ginServer *gin.Engine) {
|
||||||
|
|
||||||
if !authOk {
|
if !authOk {
|
||||||
s.CloseWithMsg([]byte(" unauthenticated"))
|
s.CloseWithMsg([]byte(" unauthenticated"))
|
||||||
//logging.LogWarnf("closed an unauthenticated session [%s]", util.GetRemoteAddr(s))
|
logging.LogWarnf("closed an unauthenticated session [%s]", util.GetRemoteAddr(s))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
util.AddPushChan(s)
|
util.AddPushChan(s)
|
||||||
//sessionId, _ := s.Get("id")
|
sessionId, _ := s.Get("id")
|
||||||
//logging.LogInfof("ws [%s] connected", sessionId)
|
logging.LogInfof("ws [%s] connected", sessionId)
|
||||||
})
|
})
|
||||||
|
|
||||||
util.WebSocketServer.HandleDisconnect(func(s *melody.Session) {
|
util.WebSocketServer.HandleDisconnect(func(s *melody.Session) {
|
||||||
util.RemovePushChan(s)
|
util.RemovePushChan(s)
|
||||||
//sessionId, _ := s.Get("id")
|
sessionId, _ := s.Get("id")
|
||||||
//logging.LogInfof("ws [%s] disconnected", sessionId)
|
logging.LogInfof("ws [%s] disconnected", sessionId)
|
||||||
})
|
})
|
||||||
|
|
||||||
util.WebSocketServer.HandleError(func(s *melody.Session, err error) {
|
util.WebSocketServer.HandleError(func(s *melody.Session, err error) {
|
||||||
//sessionId, _ := s.Get("id")
|
sessionId, _ := s.Get("id")
|
||||||
//logging.LogDebugf("ws [%s] failed: %s", sessionId, err)
|
logging.LogDebugf("ws [%s] failed: %s", sessionId, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
util.WebSocketServer.HandleClose(func(s *melody.Session, i int, str string) error {
|
util.WebSocketServer.HandleClose(func(s *melody.Session, i int, str string) error {
|
||||||
//sessionId, _ := s.Get("id")
|
sessionId, _ := s.Get("id")
|
||||||
//logging.LogDebugf("ws [%s] closed: %v, %v", sessionId, i, str)
|
logging.LogDebugf("ws [%s] closed: %v, %v", sessionId, i, str)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue