mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 10:55:51 +02:00
refactor: improve variable naming in nginx log filtering functions and enhance error message clarity
This commit is contained in:
parent
56f4e5b87f
commit
7a9b7d552d
2 changed files with 7 additions and 7 deletions
|
@ -129,20 +129,20 @@ func GetLogList(c *gin.Context) {
|
||||||
filters := []func(*cache.NginxLogCache) bool{}
|
filters := []func(*cache.NginxLogCache) bool{}
|
||||||
|
|
||||||
if c.Query("type") != "" {
|
if c.Query("type") != "" {
|
||||||
filters = append(filters, func(cache *cache.NginxLogCache) bool {
|
filters = append(filters, func(entry *cache.NginxLogCache) bool {
|
||||||
return cache.Type == c.Query("type")
|
return entry.Type == c.Query("type")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Query("name") != "" {
|
if c.Query("name") != "" {
|
||||||
filters = append(filters, func(cache *cache.NginxLogCache) bool {
|
filters = append(filters, func(entry *cache.NginxLogCache) bool {
|
||||||
return strings.Contains(cache.Name, c.Query("name"))
|
return strings.Contains(entry.Name, c.Query("name"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Query("path") != "" {
|
if c.Query("path") != "" {
|
||||||
filters = append(filters, func(cache *cache.NginxLogCache) bool {
|
filters = append(filters, func(entry *cache.NginxLogCache) bool {
|
||||||
return strings.Contains(cache.Path, c.Query("path"))
|
return strings.Contains(entry.Path, c.Query("path"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ func tailNginxLog(ws *websocket.Conn, controlChan chan controlStruct, errChan ch
|
||||||
|
|
||||||
stat, err := os.Stat(logPath)
|
stat, err := os.Stat(logPath)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
errChan <- errors.New("[error] log path not exists " + logPath)
|
errChan <- errors.New("[error] Log path does not exist: " + logPath)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue