mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
maillog: Support logging to stdout and stderr
This patch adds support for writing maillog to stdout and stderr, which can be desirable in certain environments. Thanks to Denys Vitali <denys@denv.it> who sent an alternative patch for this functionality.
This commit is contained in:
@@ -216,9 +216,14 @@ func loadAddresses(srv *smtpsrv.Server, addrs []string, ls []net.Listener, mode
|
||||
func initMailLog(path string) {
|
||||
var err error
|
||||
|
||||
if path == "<syslog>" {
|
||||
switch path {
|
||||
case "<syslog>":
|
||||
maillog.Default, err = maillog.NewSyslog()
|
||||
} else {
|
||||
case "<stdout>":
|
||||
maillog.Default = maillog.New(os.Stdout)
|
||||
case "<stderr>":
|
||||
maillog.Default = maillog.New(os.Stderr)
|
||||
default:
|
||||
_ = os.MkdirAll(filepath.Dir(path), 0775)
|
||||
maillog.Default, err = maillog.NewFile(path)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user