diff options
| author | Ho3ein <ho3ein.sanaei@gmail.com> | 2023-06-16 17:55:33 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-16 17:55:33 +0300 |
| commit | 5188d516e3a13e0cf4c04f8af653007983b16cb5 (patch) | |
| tree | 7b2ab0097680e00cf74eb8467dddf3598eda7ba1 /web/service | |
| parent | 97925eeebe30c2f70bad6b6c240728034638842f (diff) | |
new - loglevel (#612)
Diffstat (limited to 'web/service')
| -rw-r--r-- | web/service/server.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/web/service/server.go b/web/service/server.go index d5f7adc1..936e6469 100644 --- a/web/service/server.go +++ b/web/service/server.go @@ -380,16 +380,17 @@ func (s *ServerService) UpdateXray(version string) error { } -func (s *ServerService) GetLogs(count string) ([]string, error) { - // Define the journalctl command and its arguments +func (s *ServerService) GetLogs(count string, logLevel string) ([]string, error) { var cmdArgs []string if runtime.GOOS == "linux" { cmdArgs = []string{"journalctl", "-u", "x-ui", "--no-pager", "-n", count} + if logLevel != "" { + cmdArgs = append(cmdArgs, "-p", logLevel) + } } else { return []string{"Unsupported operating system"}, nil } - // Run the command cmd := exec.Command(cmdArgs[0], cmdArgs[1:]...) var out bytes.Buffer cmd.Stdout = &out |
