mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-12-17 04:34:40 +03:00
new - loglevel (#612)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user