mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 18:35:51 +02:00
enhance: find out the highest log level of nginx
This commit is contained in:
parent
b6cbc34e6f
commit
6fa90a15e4
3 changed files with 9 additions and 6 deletions
|
@ -21,11 +21,13 @@ var logLevel = [...]string{
|
|||
"debug", "info", "notice", "warn", "error", "crit", "alert", "emerg",
|
||||
}
|
||||
|
||||
func GetLogLevel(output string) int {
|
||||
func GetLogLevel(output string) (level int) {
|
||||
level = -1
|
||||
for k, v := range logLevel {
|
||||
if strings.Contains(output, v) {
|
||||
return k
|
||||
// Try to find the highest log level
|
||||
level = k
|
||||
}
|
||||
}
|
||||
return -1
|
||||
return
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
)
|
||||
|
||||
func execShell(cmd string) (out string) {
|
||||
bytes, err := exec.Command("/bin/sh -c", cmd).CombinedOutput()
|
||||
bytes, err := exec.Command("/bin/sh", "-c", cmd).CombinedOutput()
|
||||
out = string(bytes)
|
||||
if err != nil {
|
||||
out += " " + err.Error()
|
||||
|
@ -60,8 +60,6 @@ func Restart() (out string) {
|
|||
|
||||
out += execCommand("nginx")
|
||||
|
||||
logger.Debug(out)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue