Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging to Mist Client #58

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions clients/mist_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"net/http"
"net/url"
"sync"

"github.com/livepeer/catalyst-api/config"
)

type MistAPIClient interface {
Expand All @@ -28,16 +30,19 @@ type MistClient struct {
}

func (mc *MistClient) AddStream(streamName, sourceUrl string) error {
_ = config.Logger.Log("msg", "mistClient.AddStream", "streamName", streamName, "sourceURL", sourceUrl)
c := commandAddStream(streamName, sourceUrl)
return wrapErr(validateAddStream(mc.sendCommand(c)), streamName)
}

func (mc *MistClient) PushStart(streamName, targetURL string) error {
_ = config.Logger.Log("msg", "mistClient.PushStart", "streamName", streamName, "targetURL", targetURL)
c := commandPushStart(streamName, targetURL)
return wrapErr(validatePushStart(mc.sendCommand(c)), streamName)
}

func (mc *MistClient) DeleteStream(streamName string) error {
_ = config.Logger.Log("msg", "mistClient.DeleteStream", "streamName", streamName)
c := commandDeleteStream(streamName)
return wrapErr(validateDeleteStream(mc.sendCommand(c)), streamName)
}
Expand All @@ -50,6 +55,7 @@ func (mc *MistClient) DeleteStream(streamName string) error {
// 4. Override the triggers
// 5. Release the lock
func (mc *MistClient) AddTrigger(streamName, triggerName string) error {
_ = config.Logger.Log("msg", "mistClient.AddTrigger", "streamName", streamName, "triggerName", triggerName)
mc.configMu.Lock()
defer mc.configMu.Unlock()

Expand All @@ -70,6 +76,7 @@ func (mc *MistClient) AddTrigger(streamName, triggerName string) error {
// 4. Override the triggers
// 5. Release the lock
func (mc *MistClient) DeleteTrigger(streamName, triggerName string) error {
_ = config.Logger.Log("msg", "mistClient.DeleteTrigger", "streamName", streamName, "triggerName", triggerName)
mc.configMu.Lock()
defer mc.configMu.Unlock()

Expand Down