1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

maillog: Use blitiri.com.ar/go/log for mail log

In preparation for supporting log rotation, this patch makes the maillog
package to use blitiri.com.ar/go/log instead of its own writer.

Some of the tests are made more strict, to better test the log format.

Amended-by: Alberto Bertogli <albertito@blitiri.com.ar>
  Fixed build, extended commit message, adjusted to the log options
  API, and added tests.
This commit is contained in:
ThinkChaos
2020-05-21 01:51:35 +02:00
committed by Alberto Bertogli
parent 0f686399b6
commit ade107f62e
3 changed files with 63 additions and 48 deletions

View File

@@ -216,9 +216,7 @@ func initMailLog(path string) {
maillog.Default, err = maillog.NewSyslog()
} else {
_ = os.MkdirAll(filepath.Dir(path), 0775)
var f *os.File
f, err = os.OpenFile(path, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0664)
maillog.Default = maillog.New(f)
maillog.Default, err = maillog.NewFile(path)
}
if err != nil {