mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-09 19:45:58 +08:00
packet name pb
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/common/config"
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
elasticV7 "github.com/olivere/elastic/v7"
|
||||
"github.com/sirupsen/logrus"
|
||||
"log"
|
||||
@@ -18,13 +18,13 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
//esHook CUSTOMIZED ES hook
|
||||
// esHook CUSTOMIZED ES hook
|
||||
type esHook struct {
|
||||
moduleName string
|
||||
client *elasticV7.Client
|
||||
}
|
||||
|
||||
//newEsHook Initialization
|
||||
// newEsHook Initialization
|
||||
func newEsHook(moduleName string) *esHook {
|
||||
//https://github.com/sohlich/elogrus
|
||||
//client, err := elastic.NewClient(elastic.SetURL("http://localhost:9200"))
|
||||
@@ -61,7 +61,7 @@ func newEsHook(moduleName string) *esHook {
|
||||
return &esHook{client: es, moduleName: moduleName}
|
||||
}
|
||||
|
||||
//Fire log hook interface
|
||||
// Fire log hook interface
|
||||
func (hook *esHook) Fire(entry *logrus.Entry) error {
|
||||
doc := newEsLog(entry)
|
||||
go hook.sendEs(doc)
|
||||
@@ -72,7 +72,7 @@ func (hook *esHook) Levels() []logrus.Level {
|
||||
return logrus.AllLevels
|
||||
}
|
||||
|
||||
//sendEs
|
||||
// sendEs
|
||||
func (hook *esHook) sendEs(doc appLogDocModel) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
@@ -86,7 +86,7 @@ func (hook *esHook) sendEs(doc appLogDocModel) {
|
||||
|
||||
}
|
||||
|
||||
//appLogDocModel es model
|
||||
// appLogDocModel es model
|
||||
type appLogDocModel map[string]interface{}
|
||||
|
||||
func newEsLog(e *logrus.Entry) appLogDocModel {
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/utils"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
|
||||
"github.com/sirupsen/logrus"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/common/config"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
nested "github.com/antonfisher/nested-logrus-formatter"
|
||||
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
|
||||
"github.com/rifflock/lfshook"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/tracelog"
|
||||
"bufio"
|
||||
"context"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tracelog"
|
||||
|
||||
//"bufio"
|
||||
"fmt"
|
||||
@@ -128,7 +128,7 @@ func Debug(OperationID string, args ...interface{}) {
|
||||
}).Debugln(args)
|
||||
}
|
||||
|
||||
//Deprecated
|
||||
// Deprecated
|
||||
func Warning(token, OperationID, format string, args ...interface{}) {
|
||||
logger.WithFields(logrus.Fields{
|
||||
"PID": logger.Pid,
|
||||
@@ -137,7 +137,7 @@ func Warning(token, OperationID, format string, args ...interface{}) {
|
||||
|
||||
}
|
||||
|
||||
//internal method
|
||||
// internal method
|
||||
func argsHandle(OperationID string, fields logrus.Fields, args []interface{}) {
|
||||
for i := 0; i < len(args); i += 2 {
|
||||
if i+1 < len(args) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/constant"
|
||||
"OpenIM/pkg/common/tracelog"
|
||||
"context"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/constant"
|
||||
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/tracelog"
|
||||
rotatelogs "github.com/lestrrat-go/file-rotatelogs"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
Reference in New Issue
Block a user