mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-12 19:05:55 +02:00
feat: inspect configurations #69
This commit is contained in:
parent
561771cf10
commit
768da42e35
23 changed files with 346 additions and 144 deletions
30
server/pkg/nginx/log.go
Normal file
30
server/pkg/nginx/log.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package nginx
|
||||
|
||||
import "strings"
|
||||
|
||||
// refer to https://nginx.org/en/docs/ngx_core_module.html#error_log
|
||||
// nginx log level: debug, info, notice, warn, error, crit, alert, or emerg
|
||||
|
||||
const (
|
||||
Debug = iota
|
||||
Info
|
||||
Notice
|
||||
Warn
|
||||
Error
|
||||
Crit
|
||||
Alert
|
||||
Emerg
|
||||
)
|
||||
|
||||
var logLevel = [...]string{
|
||||
"debug", "info", "notice", "warn", "error", "crit", "alert", "emerg",
|
||||
}
|
||||
|
||||
func GetLogLevel(output string) int {
|
||||
for k, v := range logLevel {
|
||||
if strings.Contains(output, v) {
|
||||
return k
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue