Skip to content

Commit 77a5c09

Browse files
author
Christian Weichel
committed
[docker-up] Enable proper verbose logging
1 parent 525dd43 commit 77a5c09

File tree

1 file changed

+8
-2
lines changed
  • components/docker-up/docker-up

1 file changed

+8
-2
lines changed

components/docker-up/docker-up/main.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ var opts struct {
2929
BinDir string
3030
AutoInstall bool
3131
UserAccessibleSocket bool
32+
Verbose bool
3233
}
3334

3435
func main() {
@@ -37,15 +38,15 @@ func main() {
3738
log.WithError(err).Fatal()
3839
}
3940

40-
verbose := pflag.BoolP("verbose", "v", false, "enables verbose logging")
41+
pflag.BoolVarP(&opts.Verbose, "verbose", "v", false, "enables verbose logging")
4142
pflag.BoolVar(&opts.RuncFacade, "runc-facade", true, "enables the runc-facade to handle rootless idiosyncrasies")
4243
pflag.StringVar(&opts.BinDir, "bin-dir", filepath.Dir(self), "directory where runc-facade and slirp-docker-proxy are found")
4344
pflag.BoolVar(&opts.AutoInstall, "auto-install", true, "auto-install prerequisites (docker, slirp4netns)")
4445
pflag.BoolVar(&opts.UserAccessibleSocket, "user-accessible-socket", true, "chmod the Docker socket to make it user accessible")
4546
pflag.Parse()
4647

4748
logger := logrus.New()
48-
if *verbose {
49+
if opts.Verbose {
4950
logger.SetLevel(logrus.DebugLevel)
5051
}
5152

@@ -90,6 +91,11 @@ func runWithinNetns() (err error) {
9091
"--data-root=/workspace/.docker-root",
9192
"--userland-proxy", "--userland-proxy-path=" + filepath.Join(opts.BinDir, "slirp-docker-proxy"),
9293
}
94+
if opts.Verbose {
95+
args = append(args,
96+
"--log-level", "debug",
97+
)
98+
}
9399
if opts.RuncFacade {
94100
args = append(args,
95101
"--add-runtime", "gitpod="+filepath.Join(opts.BinDir, "runc-facade"),

0 commit comments

Comments
 (0)