Skip to content

Commit 36e8461

Browse files
derekbitinnobead
authored andcommitted
Unify fatal log messages
Longhorn 4210 Longhorn 3198 Signed-off-by: Derek Su <derek.su@suse.com>
1 parent e263e72 commit 36e8461

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

app/cmd/process.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func ProcessCreateCmd() cli.Command {
4444
},
4545
Action: func(c *cli.Context) {
4646
if err := createProcess(c); err != nil {
47-
logrus.Fatalf("Error running process create command: %v.", err)
47+
logrus.WithError(err).Fatal("Error running process create command")
4848
}
4949
},
5050
}
@@ -75,7 +75,7 @@ func ProcessDeleteCmd() cli.Command {
7575
},
7676
Action: func(c *cli.Context) {
7777
if err := deleteProcess(c); err != nil {
78-
logrus.Fatalf("Error running process delete command: %v.", err)
78+
logrus.WithError(err).Fatal("Error running process delete command")
7979
}
8080
},
8181
}
@@ -105,7 +105,7 @@ func ProcessGetCmd() cli.Command {
105105
},
106106
Action: func(c *cli.Context) {
107107
if err := getProcess(c); err != nil {
108-
logrus.Fatalf("Error running process get command: %v.", err)
108+
logrus.WithError(err).Fatal("Error running process get command")
109109
}
110110
},
111111
}
@@ -131,7 +131,7 @@ func ProcessListCmd() cli.Command {
131131
ShortName: "ls",
132132
Action: func(c *cli.Context) {
133133
if err := listProcess(c); err != nil {
134-
logrus.Fatalf("Error running engine stop command: %v.", err)
134+
logrus.WithError(err).Fatal("Error running engine stop command")
135135
}
136136
},
137137
}
@@ -176,7 +176,7 @@ func ProcessReplaceCmd() cli.Command {
176176
},
177177
Action: func(c *cli.Context) {
178178
if err := replaceProcess(c); err != nil {
179-
logrus.Fatalf("Error running engine replace command: %v.", err)
179+
logrus.WithError(err).Fatal("Error running engine replace command")
180180
}
181181
},
182182
}

app/cmd/start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func StartCmd() cli.Command {
4646
},
4747
Action: func(c *cli.Context) {
4848
if err := start(c); err != nil {
49-
logrus.Fatalf("Failed to run start command: %v.", err)
49+
logrus.WithError(err).Fatal("Failed to run start command")
5050
}
5151
},
5252
}

app/cmd/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func VersionCmd() cli.Command {
2020
},
2121
Action: func(c *cli.Context) {
2222
if err := version(c); err != nil {
23-
logrus.Fatalln("Error running info command:", err)
23+
logrus.WithError(err).Fatal("Error running info command")
2424
}
2525
},
2626
}

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ func main() {
5353
cmd.VersionCmd(),
5454
}
5555
if err := a.Run(os.Args); err != nil {
56-
logrus.Fatal("Error when executing command: ", err)
56+
logrus.WithError(err).Fatal("Error when executing command")
5757
}
5858
}

0 commit comments

Comments
 (0)