diff --git a/database/gdb/gdb_core.go b/database/gdb/gdb_core.go index 9c5a487e4..88b8d55a1 100644 --- a/database/gdb/gdb_core.go +++ b/database/gdb/gdb_core.go @@ -642,7 +642,7 @@ func (c *Core) writeSqlToLogger(ctx context.Context, sql *Sql) { } } s := fmt.Sprintf( - "[%3d ms] [%s] [%s:%d] %s%s", + "[%3d ms] [%s] [%s:%-3d] %s%s", sql.End-sql.Start, sql.Group, sqlTypeKey, sql.RowsAffected, transactionIdStr, sql.Format, ) if sql.Error != nil { diff --git a/encoding/gini/gini.go b/encoding/gini/gini.go index 878b6216b..55b5325cf 100644 --- a/encoding/gini/gini.go +++ b/encoding/gini/gini.go @@ -65,7 +65,7 @@ func Decode(data []byte) (res map[string]interface{}, err error) { if strings.Contains(lineStr, "=") && haveSection { values := strings.Split(lineStr, "=") - fieldMap[strings.TrimSpace(values[0])] = strings.TrimSpace(strings.Join(values[1:], "")) + fieldMap[strings.TrimSpace(values[0])] = strings.TrimSpace(strings.Join(values[1:], "=")) res[section] = fieldMap } } diff --git a/encoding/gini/gini_test.go b/encoding/gini/gini_test.go index 1295a0d8a..e080d8900 100644 --- a/encoding/gini/gini_test.go +++ b/encoding/gini/gini_test.go @@ -22,6 +22,7 @@ aa=bb ip = 127.0.0.1 port=9001 enable=true +command=/bin/echo "gf=GoFrame" [DBINFO] type=mysql @@ -40,6 +41,7 @@ func TestDecode(t *testing.T) { } t.Assert(res["addr"].(map[string]interface{})["ip"], "127.0.0.1") t.Assert(res["addr"].(map[string]interface{})["port"], "9001") + t.Assert(res["addr"].(map[string]interface{})["command"], `/bin/echo "gf=GoFrame"`) t.Assert(res["DBINFO"].(map[string]interface{})["user"], "root") t.Assert(res["DBINFO"].(map[string]interface{})["type"], "mysql") t.Assert(res["键"].(map[string]interface{})["呵呵"], "值") diff --git a/os/glog/glog_logger.go b/os/glog/glog_logger.go index 79be582b7..bdd873976 100644 --- a/os/glog/glog_logger.go +++ b/os/glog/glog_logger.go @@ -202,7 +202,7 @@ func (l *Logger) print(ctx context.Context, level int, values ...interface{}) { if len(input.Content) > 0 { if input.Content[len(input.Content)-1] == '\n' { // Remove one blank line(\n\n). - if tempStr[0] == '\n' { + if len(tempStr) > 0 && tempStr[0] == '\n' { input.Content += tempStr[1:] } else { input.Content += tempStr