mirror of
https://github.com/containers/podman.git
synced 2025-12-10 15:47:46 +08:00
Merge pull request #20062 from vrothberg/syslog-fix
pass --syslog to the cleanup process
This commit is contained in:
@@ -76,7 +76,6 @@ var (
|
||||
dockerConfig = ""
|
||||
debug bool
|
||||
|
||||
useSyslog bool
|
||||
requireCleanup = true
|
||||
|
||||
// Defaults for capturing/redirecting the command output since (the) cobra is
|
||||
@@ -611,7 +610,7 @@ func rootFlags(cmd *cobra.Command, podmanConfig *entities.PodmanConfig) {
|
||||
pFlags.StringArrayVar(&podmanConfig.RuntimeFlags, runtimeflagFlagName, []string{}, "add global flags for the container runtime")
|
||||
_ = rootCmd.RegisterFlagCompletionFunc(runtimeflagFlagName, completion.AutocompleteNone)
|
||||
|
||||
pFlags.BoolVar(&useSyslog, "syslog", false, "Output logging information to syslog as well as the console (default false)")
|
||||
pFlags.BoolVar(&podmanConfig.Syslog, "syslog", false, "Output logging information to syslog as well as the console (default false)")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,13 @@ package main
|
||||
import (
|
||||
"log/syslog"
|
||||
|
||||
"github.com/containers/podman/v4/cmd/podman/registry"
|
||||
"github.com/sirupsen/logrus"
|
||||
logrusSyslog "github.com/sirupsen/logrus/hooks/syslog"
|
||||
)
|
||||
|
||||
func syslogHook() {
|
||||
if !useSyslog {
|
||||
if !registry.PodmanConfig().Syslog {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,16 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/containers/podman/v4/cmd/podman/registry"
|
||||
)
|
||||
|
||||
func syslogHook() {
|
||||
if !useSyslog {
|
||||
if !registry.PodmanConfig().Syslog {
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Fprintf(os.Stderr, "Logging to Syslog is not supported on Windows")
|
||||
fmt.Fprintf(os.Stderr, "Logging to Syslog is not supported on %s", runtime.GOOS)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user