Skip to content

Commit

Permalink
Add a --loglevel option to build-with-dockerfile
Browse files Browse the repository at this point in the history
Add a --loglevel option to build-with-dockerfile and use it to add
a value from -2 to 3 to the default logrus LogError logging level.
This makes --loglevel 3 equivalent in effect to the global --debug
option.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>

Closes: #845
Approved by: rhatdan
  • Loading branch information
nalind authored and rh-atomic-bot committed Jul 5, 2018
1 parent a59fb7a commit 7bafc30
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/buildah/main.go
Expand Up @@ -76,7 +76,7 @@ func main() {
},
}
app.Before = func(c *cli.Context) error {
logrus.SetLevel(logrus.ErrorLevel)
logrus.SetLevel(logrus.ErrorLevel + logrus.Level(c.Int("loglevel")))
if c.GlobalBool("debug") {
debug = true
logrus.SetLevel(logrus.DebugLevel)
Expand Down
1 change: 1 addition & 0 deletions contrib/completions/bash/buildah
Expand Up @@ -388,6 +388,7 @@ return 1
--iidfile
--ipc
--label
--loglevel
-m
--memory
--memory-swap
Expand Down
6 changes: 6 additions & 0 deletions docs/buildah-bud.md
Expand Up @@ -223,6 +223,12 @@ BUILDAH\_ISOLATION environment variable. `export BUILDAH_ISOLATION=oci`

Add an image *label* (e.g. label=*value*) to the image metadata. Can be used multiple times.

**--loglevel** *number*

Adjust the logging level up or down. Valid option values range from -2 to 3,
with 3 being roughly equivalent to using the global *--debug* option, and
values below 0 omitting even error messages which accompany fatal errors.

**--layers** *bool-value*

Cache intermediate images during the build process (Default is `false`).
Expand Down
4 changes: 4 additions & 0 deletions pkg/cli/common.go
Expand Up @@ -139,6 +139,10 @@ var (
Name: "logfile",
Usage: "log to `file` instead of stdout/stderr",
},
cli.IntFlag{
Name: "loglevel",
Usage: "adjust logging level (range from -2 to 3)",
},
cli.BoolTFlag{
Name: "pull",
Usage: "pull the image if not present",
Expand Down

0 comments on commit 7bafc30

Please sign in to comment.