diff options
| author | Shulhan <ms@kilabit.info> | 2023-10-26 22:23:58 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-10-26 22:24:16 +0700 |
| commit | f2b0021604e898e78ad53100057fd7da0b2187a6 (patch) | |
| tree | 3aa3dd21cc38261b4a38c6056813d53235fecb48 /awwan.go | |
| parent | f2da8879166f60ec65671afaebc18b2c4dbb918a (diff) | |
| download | awwan-f2b0021604e898e78ad53100057fd7da0b2187a6.tar.xz | |
all: use "mlog.MultiLogger" to log Request output and error
By using "mlog.MultiLogger" every output or error can be written to
stdout/stderr and additional log writer that can collect both of them,
buffered and returned to the caller.
This changes simplify the HttpResponse to use only single output that
combine both stdout and stderr.
Diffstat (limited to 'awwan.go')
| -rw-r--r-- | awwan.go | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -211,6 +211,8 @@ func (aww *Awwan) Local(req *Request) (err error) { if errRemove != nil { log.Printf(`%s: %s`, logp, errRemove) } + + req.mlog.Flush() }() var pos linePosition @@ -283,7 +285,10 @@ func (aww *Awwan) Play(req *Request) (err error) { return fmt.Errorf("%s: %w", logp, err) } - defer ses.sshc.rmdirAll(ses.sshc.dirTmp) + defer func() { + ses.sshc.rmdirAll(ses.sshc.dirTmp) + req.mlog.Flush() + }() var pos linePosition for _, pos = range req.lineRange.list { |
