打印http hook响应

This commit is contained in:
yangjiechina
2024-07-16 21:17:22 +08:00
parent 6a9a797f3f
commit c353600844
9 changed files with 42 additions and 31 deletions

View File

@@ -20,7 +20,6 @@ func PreparePublishSource(source Source, hook bool) (*http.Response, utils.HookS
}
if err := SourceManager.Add(source); err != nil {
log.Sugar.Errorf("添加源失败 source:%s err:%s", source.Id(), err.Error())
return nil, utils.HookStateOccupy
}
@@ -45,7 +44,6 @@ func HookPublishEvent(source Source) (*http.Response, utils.HookState) {
if AppConfig.Hook.IsEnablePublishEvent() {
hook, err := Hook(HookEventPublish, source.UrlValues().Encode(), NewHookPublishEventInfo(source))
if err != nil {
log.Sugar.Errorf("通知推流事件失败 source:%s err:%s", source.Id(), err.Error())
return hook, utils.HookStateFailure
}
@@ -57,10 +55,7 @@ func HookPublishEvent(source Source) (*http.Response, utils.HookState) {
func HookPublishDoneEvent(source Source) {
if AppConfig.Hook.IsEnablePublishEvent() {
_, err := Hook(HookEventPublishDone, source.UrlValues().Encode(), NewHookPublishEventInfo(source))
if err != nil {
log.Sugar.Errorf("通知推流结束事件失败 source:%s err:%s", source.Id(), err.Error())
}
_, _ = Hook(HookEventPublishDone, source.UrlValues().Encode(), NewHookPublishEventInfo(source))
}
}
@@ -70,7 +65,6 @@ func HookReceiveTimeoutEvent(source Source) (*http.Response, utils.HookState) {
if AppConfig.Hook.IsEnableOnReceiveTimeout() {
resp, err := Hook(HookEventReceiveTimeout, source.UrlValues().Encode(), NewHookPublishEventInfo(source))
if err != nil {
log.Sugar.Errorf("通知收流超时事件失败 source:%s err:%s", source.Id(), err.Error())
return resp, utils.HookStateFailure
}
@@ -86,7 +80,6 @@ func HookIdleTimeoutEvent(source Source) (*http.Response, utils.HookState) {
if AppConfig.Hook.IsEnableOnIdleTimeout() {
resp, err := Hook(HookEventIdleTimeout, source.UrlValues().Encode(), NewHookPublishEventInfo(source))
if err != nil {
log.Sugar.Errorf("通知空闲超时时间失败 source:%s err:%s", source.Id(), err.Error())
return resp, utils.HookStateFailure
}