Compare commits
1 Commits
acc471e500
...
discours-d
Author | SHA1 | Date | |
---|---|---|---|
46e93aeefd |
@@ -16,9 +16,9 @@ func (u LogTextFormatter) Format(e *logrus.Entry) ([]byte, error) {
|
||||
level := strings.ToUpper(e.Level.String())
|
||||
message := e.Message
|
||||
parts := strings.SplitN(message, " +0000]", 2)
|
||||
if len(parts) >= 2 {
|
||||
message = parts[1]
|
||||
}
|
||||
if len(parts) >= 2 {
|
||||
message = parts[1]
|
||||
}
|
||||
|
||||
var color string
|
||||
switch e.Level {
|
||||
@@ -34,12 +34,16 @@ func (u LogTextFormatter) Format(e *logrus.Entry) ([]byte, error) {
|
||||
color = "\033[0m" // reset
|
||||
}
|
||||
|
||||
if e.Caller != nil {
|
||||
fmt.Sprintf("%r", e)
|
||||
file := filepath.Base(e.Caller.File)
|
||||
line := e.Caller.Line
|
||||
return []byte(fmt.Sprintf("%s[%s] %s:%d %s%s\033[0m\n", color, level, file, line, message, color)), nil
|
||||
var fields string
|
||||
for key, value := range e.Data {
|
||||
fields += fmt.Sprintf("%s=%v ", key, value)
|
||||
}
|
||||
|
||||
return []byte(fmt.Sprintf("%s[%s] %s%s\033[0m\n", color, level, message, color)), nil
|
||||
if e.Caller != nil {
|
||||
file := filepath.Base(e.Caller.File)
|
||||
line := e.Caller.Line
|
||||
return []byte(fmt.Sprintf("%s[%s] %s:%d %s %s%s\033[0m\n", color, level, file, line, message, fields, color)), nil
|
||||
}
|
||||
|
||||
return []byte(fmt.Sprintf("%s[%s] %s %s%s\033[0m\n", color, level, message, fields, color)), nil
|
||||
}
|
||||
|
@@ -234,10 +234,10 @@ func (c *provider) GetUserAppDataFromRedis(userId string) (string, error) {
|
||||
rkey := fmt.Sprintf("author:user:%s", userId)
|
||||
fmt.Println("get redis cached by key:", rkey)
|
||||
authorIdString, err := c.store.Get(c.ctx, rkey).Result()
|
||||
fmt.Println("redis found string value:", authorIdString)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
fmt.Println("redis found string value:", authorIdString)
|
||||
|
||||
// Преобразуем ID автора из строки в int
|
||||
var authorIdFloat float64
|
||||
|
Reference in New Issue
Block a user