|
|
@@ -16,6 +16,11 @@ import (
|
|
|
"strings"
|
|
|
)
|
|
|
|
|
|
+var (
|
|
|
+ VERSION string
|
|
|
+ GITHASH string
|
|
|
+)
|
|
|
+
|
|
|
// LogList 列出日志文件
|
|
|
func LogList(c *gin.Context) {
|
|
|
host := c.Request.Host
|
|
|
@@ -24,10 +29,13 @@ func LogList(c *gin.Context) {
|
|
|
}
|
|
|
|
|
|
const templateText = `
|
|
|
-<h1>日志文件列表</h1>
|
|
|
+<h1>go查询服务信息</h1>
|
|
|
+version : {{.version}}<br>
|
|
|
+git hash: {{.githash}}<br>
|
|
|
oracle : {{.db}} <br>
|
|
|
mysql : {{.mysql}} <br>
|
|
|
redis : {{.redis}} <br>
|
|
|
+<h1>日志文件列表</h1>
|
|
|
<p>------------------------</p>
|
|
|
{{.data}}
|
|
|
<p>------------------------</p>
|
|
|
@@ -61,7 +69,8 @@ redis : {{.redis}} <br>
|
|
|
str := strings.Join(sFile, "\n<br>")
|
|
|
if tmpl, err := template.New("index").Parse(templateText); err == nil {
|
|
|
_ = tmpl.Execute(c.Writer, gin.H{"data": template.HTML(str), "db": template.HTML(db),
|
|
|
- "mysql": template.HTML(mysql), "redis": template.HTML(redis)})
|
|
|
+ "mysql": template.HTML(mysql), "redis": template.HTML(redis),
|
|
|
+ "version": template.HTML(VERSION), "githash": template.HTML(GITHASH)})
|
|
|
} else {
|
|
|
c.String(400, "index err.")
|
|
|
}
|