- 优化日志版本信息
continuous-integration/drone/push Build is passing Details

master v1.0.9
李光春 2 years ago
parent 7e12e40ce4
commit 0ff9f0fc4b

@ -11,7 +11,7 @@ type api struct {
tableName string // 日志表名
insideIp string // 内网ip
hostname string // 主机名
goVersion float64 // go版本
goVersion string // go版本
}
// ApiPostgresqlLog 结构体
@ -31,7 +31,7 @@ type ApiPostgresqlLog struct {
ResponseTime TimeString `gorm:"index" json:"response_time"` //【返回】时间
SystemHostName string `gorm:"type:text" json:"system_host_name"` //【系统】主机名
SystemInsideIp string `gorm:"type:text" json:"system_inside_ip"` //【系统】内网ip
GoVersion float64 `gorm:"type:bigint" json:"go_version"` //【程序】Go版本
GoVersion string `gorm:"type:text" json:"go_version"` //【程序】Go版本
}
// AutoMigrate 自动迁移

@ -5,7 +5,6 @@ import (
"gorm.io/gorm"
"os"
"runtime"
"strconv"
"strings"
)
@ -28,8 +27,7 @@ func (a *App) InitClientApi() {
a.Api.tableName = a.TableName
a.Api.hostname, _ = os.Hostname()
a.Api.insideIp = goip.GetInsideIp()
goVersion, _ := strconv.ParseFloat(strings.TrimPrefix(runtime.Version(), "go"), 64)
a.Api.goVersion = goVersion
a.Api.goVersion = strings.TrimPrefix(runtime.Version(), "go")
a.Api.AutoMigrate()
}
@ -45,7 +43,6 @@ func (a *App) InitClientGin() {
a.Gin.tableName = a.TableName
a.Gin.hostname, _ = os.Hostname()
a.Gin.insideIp = goip.GetInsideIp()
goVersion, _ := strconv.ParseFloat(strings.TrimPrefix(runtime.Version(), "go"), 64)
a.Gin.goVersion = goVersion
a.Gin.goVersion = strings.TrimPrefix(runtime.Version(), "go")
a.Gin.AutoMigrate()
}

@ -5,7 +5,6 @@ import (
"gorm.io/gorm"
"os"
"runtime"
"strconv"
"strings"
)
@ -23,8 +22,7 @@ func NewClientGin(db *gorm.DB, tableName string) *Client {
panic("表名不能为空")
}
hostname, _ := os.Hostname()
goVersion, _ := strconv.ParseFloat(strings.TrimPrefix(runtime.Version(), "go"), 64)
client := &Client{Gin: gin{db: db, tableName: tableName, hostname: hostname, insideIp: goip.GetInsideIp(), goVersion: goVersion}}
client := &Client{Gin: gin{db: db, tableName: tableName, hostname: hostname, insideIp: goip.GetInsideIp(), goVersion: strings.TrimPrefix(runtime.Version(), "go")}}
client.Gin.AutoMigrate()
return client
}
@ -38,8 +36,7 @@ func NewClientApi(db *gorm.DB, tableName string) *Client {
panic("表名不能为空")
}
hostname, _ := os.Hostname()
goVersion, _ := strconv.ParseFloat(strings.TrimPrefix(runtime.Version(), "go"), 64)
client := &Client{Api: api{db: db, tableName: tableName, hostname: hostname, insideIp: goip.GetInsideIp(), goVersion: goVersion}}
client := &Client{Api: api{db: db, tableName: tableName, hostname: hostname, insideIp: goip.GetInsideIp(), goVersion: strings.TrimPrefix(runtime.Version(), "go")}}
client.Api.AutoMigrate()
return client
}

@ -11,7 +11,7 @@ type gin struct {
tableName string // 日志表名
insideIp string // 内网ip
hostname string // 主机名
goVersion float64 // go版本
goVersion string // go版本
}
// GinPostgresqlLog 结构体
@ -42,7 +42,7 @@ type GinPostgresqlLog struct {
CostTime int64 `gorm:"type:bigint" json:"cost_time"` //【系统】花费时间
SystemHostName string `gorm:"type:text" json:"system_host_name"` //【系统】主机名
SystemInsideIp string `gorm:"type:text" json:"system_inside_ip"` //【系统】内网ip
GoVersion float64 `gorm:"type:bigint" json:"go_version"` //【程序】Go版本
GoVersion string `gorm:"type:bigint" json:"go_version"` //【程序】Go版本
}
// AutoMigrate 自动迁移

@ -2,7 +2,6 @@ package golog
import (
"runtime"
"strconv"
"strings"
"testing"
)
@ -12,6 +11,5 @@ func TestSystem(t *testing.T) {
s.Init()
t.Logf("%+v", s)
t.Logf("%+v", runtime.Version())
goVersion, _ := strconv.ParseFloat(strings.TrimPrefix(runtime.Version(), "go"), 64)
t.Logf("%+v", goVersion)
t.Logf("%+v", strings.TrimPrefix(runtime.Version(), "go"))
}

@ -1,3 +1,3 @@
package golog
const Version = "1.0.8"
const Version = "1.0.9"

Loading…
Cancel
Save