diff --git a/syslog/logger.go b/syslog/logger.go index 8a427e2..fee0f11 100644 --- a/syslog/logger.go +++ b/syslog/logger.go @@ -143,10 +143,12 @@ func Setup(opts *Options) error { log.p = priority - var err error - log.l, err = gsyslog.NewLogger(priority, opts.Facility, opts.Tag) - if err != nil { - return err + if opts.WriteSyslog { + var err error + log.l, err = gsyslog.NewLogger(priority, opts.Facility, opts.Tag) + if err != nil { + return err + } } return nil