aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-08-16 15:09:12 +0000
committerGitHub <noreply@github.com>2022-08-16 15:09:12 +0000
commit3dace12777e27a7732acb25ae78f86ced8ae04da (patch)
treea0d9531a40db608526dae5df63137a4eccb173b7 /cmd
parent552225c4144091aea0a1bbef1f956ee48af16055 (diff)
parent2d30b4dee596157d85ce9728921286a6242b5a29 (diff)
downloadpodman-3dace12777e27a7732acb25ae78f86ced8ae04da.tar.gz
podman-3dace12777e27a7732acb25ae78f86ced8ae04da.tar.bz2
podman-3dace12777e27a7732acb25ae78f86ced8ae04da.zip
Merge pull request #15317 from rhatdan/debug
Add compatibility support for --debug flag from docker
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/root.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index 3637b2674..f45dc94b2 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -71,7 +71,10 @@ var (
DisableFlagsInUseLine: true,
}
- logLevel = "warn"
+ defaultLogLevel = "warn"
+ logLevel = defaultLogLevel
+ debug bool
+
useSyslog bool
requireCleanup = true
)
@@ -310,6 +313,13 @@ func persistentPostRunE(cmd *cobra.Command, args []string) error {
func loggingHook() {
var found bool
+ if debug {
+ if logLevel != defaultLogLevel {
+ fmt.Fprintf(os.Stderr, "Setting --log-level and --debug is not allowed\n")
+ os.Exit(1)
+ }
+ logLevel = "debug"
+ }
for _, l := range common.LogLevels {
if l == strings.ToLower(logLevel) {
found = true
@@ -465,6 +475,9 @@ func rootFlags(cmd *cobra.Command, opts *entities.PodmanConfig) {
pFlags.StringVar(&logLevel, logLevelFlagName, logLevel, fmt.Sprintf("Log messages above specified level (%s)", strings.Join(common.LogLevels, ", ")))
_ = rootCmd.RegisterFlagCompletionFunc(logLevelFlagName, common.AutocompleteLogLevel)
+ pFlags.BoolVar(&debug, "debug", false, "Docker compatibility, force setting of log-level")
+ _ = pFlags.MarkHidden("debug")
+
// Only create these flags for ABI connections
if !registry.IsRemote() {
runtimeflagFlagName := "runtime-flag"