Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHo3ein <ho3ein.sanaei@gmail.com>2023-06-16 17:55:33 +0300
committerGitHub <noreply@github.com>2023-06-16 17:55:33 +0300
commit5188d516e3a13e0cf4c04f8af653007983b16cb5 (patch)
tree7b2ab0097680e00cf74eb8467dddf3598eda7ba1 /web/service
parent97925eeebe30c2f70bad6b6c240728034638842f (diff)
new - loglevel (#612)
Diffstat (limited to 'web/service')
-rw-r--r--web/service/server.go7
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