mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-12 04:55:39 +08:00
add logging to device block service (#425)
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/go-kit/kit/endpoint"
|
||||
"github.com/gorilla/mux"
|
||||
@@ -70,3 +71,17 @@ func (e Endpoints) BlockDevice(ctx context.Context, udid string) error {
|
||||
}
|
||||
return resp.(blockDeviceResponse).Err
|
||||
}
|
||||
|
||||
func (mw logmw) BlockDevice(ctx context.Context, udid string) (err error) {
|
||||
defer func(begin time.Time) {
|
||||
_ = mw.logger.Log(
|
||||
"method", "BlockDevice",
|
||||
"udid", udid,
|
||||
"err", err,
|
||||
"took", time.Since(begin),
|
||||
)
|
||||
}(time.Now())
|
||||
|
||||
err = mw.next.BlockDevice(ctx, udid)
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user