feat: inspect configurations #69

This commit is contained in:
0xJacky 2023-01-31 22:51:46 +08:00
parent 561771cf10
commit 768da42e35
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
23 changed files with 346 additions and 144 deletions

30
server/pkg/nginx/log.go Normal file
View 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
}