summaryrefslogtreecommitdiff
path: root/libpod/options.go
diff options
context:
space:
mode:
authorPeter Hunt <pehunt@redhat.com>2019-05-18 19:39:11 -0400
committerPeter Hunt <pehunt@redhat.com>2019-05-28 11:10:57 -0400
commitf61fa28d39298def261dded2644b8dcf45366415 (patch)
tree36081cf2a2644264099ffcf32836b8c85f9ddb04 /libpod/options.go
parent18d7fcb5eb1966c4d3748a50c625c01c1ebd9f5b (diff)
downloadpodman-f61fa28d39298def261dded2644b8dcf45366415.tar.gz
podman-f61fa28d39298def261dded2644b8dcf45366415.tar.bz2
podman-f61fa28d39298def261dded2644b8dcf45366415.zip
Added --log-driver and journald logging
Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'libpod/options.go')
-rw-r--r--libpod/options.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/libpod/options.go b/libpod/options.go
index 7ec7dfe63..d6eb97609 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -979,6 +979,25 @@ func WithStaticIP(ip net.IP) CtrCreateOption {
}
}
+// WithLogDriver sets the log driver for the container
+func WithLogDriver(driver string) CtrCreateOption {
+ return func(ctr *Container) error {
+ if ctr.valid {
+ return ErrCtrFinalized
+ }
+ if driver == "" {
+ return errors.Wrapf(ErrInvalidArg, "log driver must be set")
+ }
+ if driver != "journald" && driver != "k8s-file" && driver != "json-file" {
+ return errors.Wrapf(ErrInvalidArg, "invalid log driver")
+ }
+
+ ctr.config.LogDriver = driver
+
+ return nil
+ }
+}
+
// WithLogPath sets the path to the log file.
func WithLogPath(path string) CtrCreateOption {
return func(ctr *Container) error {