From c62032ed3b60a6acb61443810ecc81837816ff64 Mon Sep 17 00:00:00 2001 From: bixiaoyan Date: Wed, 23 Apr 2025 10:54:12 +0800 Subject: [PATCH] fix generate log name --- models/log.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/models/log.go b/models/log.go index e71aa1a..6df3982 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 -- Gitee