mirror of
https://gitee.com/johng/gf
synced 2026-06-26 17:35:40 +08:00
websocket增加消息类型常量
This commit is contained in:
@ -204,8 +204,8 @@ func GetServer(name...interface{}) (*Server) {
|
||||
nameToUriType : gtype.NewInt(),
|
||||
gzipMimesMap : make(map[string]struct{}),
|
||||
}
|
||||
s.errorLogger.SetBacktraceSkip(1)
|
||||
s.accessLogger.SetBacktraceSkip(1)
|
||||
//s.errorLogger.SetBacktraceSkip(1)
|
||||
//s.accessLogger.SetBacktraceSkip(1)
|
||||
// 设置路由解析缓存上限,使用LRU进行缓存淘汰
|
||||
s.serveCache.SetCap(gSERVE_CACHE_LRU_SIZE)
|
||||
s.hooksCache.SetCap(gHOOKS_CACHE_LRU_SIZE)
|
||||
|
||||
@ -11,4 +11,26 @@ import "github.com/gorilla/websocket"
|
||||
|
||||
type WebSocket struct {
|
||||
*websocket.Conn
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
// TextMessage denotes a text data message. The text message payload is
|
||||
// interpreted as UTF-8 encoded text data.
|
||||
WS_MSG_TEXT = websocket.TextMessage
|
||||
|
||||
// BinaryMessage denotes a binary data message.
|
||||
WS_MSG_BINARY = websocket.BinaryMessage
|
||||
|
||||
// CloseMessage denotes a close control message. The optional message
|
||||
// payload contains a numeric code and text. Use the FormatCloseMessage
|
||||
// function to format a close message payload.
|
||||
WS_MSG_CLOSE = websocket.CloseMessage
|
||||
|
||||
// PingMessage denotes a ping control message. The optional message payload
|
||||
// is UTF-8 encoded text.
|
||||
WS_MSG_PING = websocket.PingMessage
|
||||
|
||||
// PongMessage denotes a pong control message. The optional message payload
|
||||
// is UTF-8 encoded text.
|
||||
WS_MSG_PONG = websocket.PongMessage
|
||||
)
|
||||
@ -169,7 +169,7 @@ func (l *Logger) stdPrint(s string) {
|
||||
func (l *Logger) errPrint(s string) {
|
||||
// 记录调用回溯信息
|
||||
if l.btEnabled.Val() {
|
||||
backtrace := l.GetBacktrace(2)
|
||||
backtrace := l.GetBacktrace(3)
|
||||
if s[len(s) - 1] == byte('\n') {
|
||||
s = s + backtrace + ln
|
||||
} else {
|
||||
@ -199,7 +199,7 @@ func (l *Logger) GetBacktrace(skip...int) string {
|
||||
for i := 1; i < 10000; i++ {
|
||||
if _, cfile, cline, ok := runtime.Caller(customSkip + i + l.btSkip.Val()); ok {
|
||||
// 不打印出go源码路径
|
||||
if !gregex.IsMatchString("^" + gfile.GoRootOfBuild(), cfile) {
|
||||
if !gregex.IsMatchString("^" + gfile.GoRootOfBuild(), cfile) && !gregex.IsMatchString(`<autogenerated>`, cfile) {
|
||||
backtrace += strconv.Itoa(index) + ".\t" + cfile + ":" + strconv.Itoa(cline) + ln
|
||||
index++
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user