aboutsummaryrefslogtreecommitdiff
path: root/awwan.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-10-26 22:23:58 +0700
committerShulhan <ms@kilabit.info>2023-10-26 22:24:16 +0700
commitf2b0021604e898e78ad53100057fd7da0b2187a6 (patch)
tree3aa3dd21cc38261b4a38c6056813d53235fecb48 /awwan.go
parentf2da8879166f60ec65671afaebc18b2c4dbb918a (diff)
downloadawwan-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.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/awwan.go b/awwan.go
index 90d4fee..fc8feff 100644
--- a/awwan.go
+++ b/awwan.go
@@ -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 {