aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/manager.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/manager.go')
-rw-r--r--cmd/manager.go56
1 files changed, 40 insertions, 16 deletions
diff --git a/cmd/manager.go b/cmd/manager.go
index 20c7858682..99d283b441 100644
--- a/cmd/manager.go
+++ b/cmd/manager.go
@@ -236,10 +236,13 @@ func runRemoveLogger(c *cli.Context) error {
group = log.DEFAULT
}
name := c.Args().First()
- statusCode, msg := private.RemoveLogger(group, name)
+ ctx, cancel := installSignals()
+ defer cancel()
+
+ statusCode, msg := private.RemoveLogger(ctx, group, name)
switch statusCode {
case http.StatusInternalServerError:
- fail("InternalServerError", msg)
+ return fail("InternalServerError", msg)
}
fmt.Fprintln(os.Stdout, msg)
@@ -371,10 +374,13 @@ func commonAddLogger(c *cli.Context, mode string, vals map[string]interface{}) e
if c.IsSet("name") {
name = c.String("name")
}
- statusCode, msg := private.AddLogger(group, name, mode, vals)
+ ctx, cancel := installSignals()
+ defer cancel()
+
+ statusCode, msg := private.AddLogger(ctx, group, name, mode, vals)
switch statusCode {
case http.StatusInternalServerError:
- fail("InternalServerError", msg)
+ return fail("InternalServerError", msg)
}
fmt.Fprintln(os.Stdout, msg)
@@ -382,11 +388,14 @@ func commonAddLogger(c *cli.Context, mode string, vals map[string]interface{}) e
}
func runShutdown(c *cli.Context) error {
+ ctx, cancel := installSignals()
+ defer cancel()
+
setup("manager", c.Bool("debug"))
- statusCode, msg := private.Shutdown()
+ statusCode, msg := private.Shutdown(ctx)
switch statusCode {
case http.StatusInternalServerError:
- fail("InternalServerError", msg)
+ return fail("InternalServerError", msg)
}
fmt.Fprintln(os.Stdout, msg)
@@ -394,11 +403,14 @@ func runShutdown(c *cli.Context) error {
}
func runRestart(c *cli.Context) error {
+ ctx, cancel := installSignals()
+ defer cancel()
+
setup("manager", c.Bool("debug"))
- statusCode, msg := private.Restart()
+ statusCode, msg := private.Restart(ctx)
switch statusCode {
case http.StatusInternalServerError:
- fail("InternalServerError", msg)
+ return fail("InternalServerError", msg)
}
fmt.Fprintln(os.Stdout, msg)
@@ -406,11 +418,14 @@ func runRestart(c *cli.Context) error {
}
func runFlushQueues(c *cli.Context) error {
+ ctx, cancel := installSignals()
+ defer cancel()
+
setup("manager", c.Bool("debug"))
- statusCode, msg := private.FlushQueues(c.Duration("timeout"), c.Bool("non-blocking"))
+ statusCode, msg := private.FlushQueues(ctx, c.Duration("timeout"), c.Bool("non-blocking"))
switch statusCode {
case http.StatusInternalServerError:
- fail("InternalServerError", msg)
+ return fail("InternalServerError", msg)
}
fmt.Fprintln(os.Stdout, msg)
@@ -418,11 +433,14 @@ func runFlushQueues(c *cli.Context) error {
}
func runPauseLogging(c *cli.Context) error {
+ ctx, cancel := installSignals()
+ defer cancel()
+
setup("manager", c.Bool("debug"))
- statusCode, msg := private.PauseLogging()
+ statusCode, msg := private.PauseLogging(ctx)
switch statusCode {
case http.StatusInternalServerError:
- fail("InternalServerError", msg)
+ return fail("InternalServerError", msg)
}
fmt.Fprintln(os.Stdout, msg)
@@ -430,11 +448,14 @@ func runPauseLogging(c *cli.Context) error {
}
func runResumeLogging(c *cli.Context) error {
+ ctx, cancel := installSignals()
+ defer cancel()
+
setup("manager", c.Bool("debug"))
- statusCode, msg := private.ResumeLogging()
+ statusCode, msg := private.ResumeLogging(ctx)
switch statusCode {
case http.StatusInternalServerError:
- fail("InternalServerError", msg)
+ return fail("InternalServerError", msg)
}
fmt.Fprintln(os.Stdout, msg)
@@ -442,11 +463,14 @@ func runResumeLogging(c *cli.Context) error {
}
func runReleaseReopenLogging(c *cli.Context) error {
+ ctx, cancel := installSignals()
+ defer cancel()
+
setup("manager", c.Bool("debug"))
- statusCode, msg := private.ReleaseReopenLogging()
+ statusCode, msg := private.ReleaseReopenLogging(ctx)
switch statusCode {
case http.StatusInternalServerError:
- fail("InternalServerError", msg)
+ return fail("InternalServerError", msg)
}
fmt.Fprintln(os.Stdout, msg)