diff --git a/cmd/tusd/cli/hooks.go b/cmd/tusd/cli/hooks.go index 433234c..44664ea 100644 --- a/cmd/tusd/cli/hooks.go +++ b/cmd/tusd/cli/hooks.go @@ -1,7 +1,6 @@ package cli import ( - "strconv" "strings" "github.com/tus/tusd/v2/cmd/tusd/cli/hooks" @@ -125,14 +124,6 @@ func invokeHookSync(typ hooks.HookType, event handler.HookEvent) (httpRes handle MetricsHookInvocationsTotal.WithLabelValues(string(typ)).Add(1) id := event.Upload.ID - size := event.Upload.Size - - switch typ { - case hooks.HookPostFinish: - logEv(stdout, "UploadFinished", "id", id, "size", strconv.FormatInt(size, 10)) - case hooks.HookPostTerminate: - logEv(stdout, "UploadTerminated", "id", id) - } if hookHandler == nil { return httpRes, nil diff --git a/pkg/handler/unrouted_handler.go b/pkg/handler/unrouted_handler.go index 826df95..72fb06d 100644 --- a/pkg/handler/unrouted_handler.go +++ b/pkg/handler/unrouted_handler.go @@ -678,6 +678,7 @@ func (handler *UnroutedHandler) finishUploadIfComplete(c *httpContext, resp HTTP resp = resp.MergeWith(resp2) } + handler.log("UploadFinished", "id", info.ID, "size", strconv.FormatInt(info.Size, 10)) handler.Metrics.incUploadsFinished() // ... send the info out to the channel @@ -882,6 +883,7 @@ func (handler *UnroutedHandler) terminateUpload(c *httpContext, upload Upload, i handler.TerminatedUploads <- newHookEvent(info, c.req) } + handler.log("UploadTerminated", "id", info.ID) handler.Metrics.incUploadsTerminated() return nil