diff --git a/models/log.go b/models/log.go index e71aa1a0ed44275a56e254e2c7f12e3072f3774a..6df3982a2aa81eb9f1b6cc8d840f1f644bfd0739 100644 --- a/models/log.go +++ b/models/log.go @@ -1,6 +1,6 @@ /* * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. - * ha-api licensed under the Mulan Permissive Software License, Version 2. + * ha-api licensed under the Mulan Permissive Software License, Version 2. * See LICENSE file for more details. * Author: liqiuyu * Date: Tue Jan 12 09:51:22 2021 +0800 @@ -8,6 +8,9 @@ package models import ( + "fmt" + "strings" + "gitee.com/openeuler/ha-api/utils" "github.com/chai2010/gettext-go" ) @@ -19,12 +22,13 @@ func GenerateLog() map[string]interface{} { var out []byte var err error if out, err = utils.RunCommand(utils.CmdGenLog); err != nil { + fmt.Println(err) result["action"] = false result["error"] = gettext.Gettext("Get neokylinha log failed") return result } - filePath := string(out) + filePath := strings.Split(string(out), "\n")[0] file["filepath"] = filePath result["action"] = true result["data"] = file