Add HookInvocationFinish event to logging
This commit is contained in:
parent
513fe9fcf3
commit
4df66415d6
|
@ -51,10 +51,8 @@ func SetupPostHooks(handler *tusd.Handler) {
|
||||||
|
|
||||||
func invokeHook(typ HookType, info tusd.FileInfo) {
|
func invokeHook(typ HookType, info tusd.FileInfo) {
|
||||||
go func() {
|
go func() {
|
||||||
_, err := invokeHookSync(typ, info, false)
|
// Error handling is token care of by the function.
|
||||||
if err != nil {
|
_, _ = invokeHookSync(typ, info, false)
|
||||||
logEv("HookInvocationError", "type", string(typ), "id", info.ID, "error", err.Error())
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,10 +98,15 @@ func invokeHookSync(typ HookType, info tusd.FileInfo, captureOutput bool) ([]byt
|
||||||
output, err = cmd.Output()
|
output, err = cmd.Output()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
logEv("HookInvocationError", "type", string(typ), "id", info.ID, "error", err.Error())
|
||||||
|
} else {
|
||||||
|
logEv("HookInvocationFinish", "type", string(typ), "id", info.ID)
|
||||||
|
}
|
||||||
|
|
||||||
// Ignore the error, only, if the hook's file could not be found. This usually
|
// Ignore the error, only, if the hook's file could not be found. This usually
|
||||||
// means that the user is only using a subset of the available hooks.
|
// means that the user is only using a subset of the available hooks.
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
logEv("HookInvocationError", "type", string(typ), "id", info.ID, "error", err.Error())
|
|
||||||
err = nil
|
err = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue