Use logrus.

This commit is contained in:
Naoki Kosaka
2021-09-14 21:22:38 +09:00
parent 56bf2f093e
commit 7c33331c40
13 changed files with 115 additions and 48 deletions

View File

@ -1,16 +1,15 @@
package deliver
import (
"fmt"
"net/http"
"net/url"
"os"
"time"
"github.com/RichardKnop/machinery/v1"
"github.com/RichardKnop/machinery/v1/log"
"github.com/go-redis/redis"
uuid "github.com/satori/go.uuid"
"github.com/sirupsen/logrus"
"github.com/yukimochi/Activity-Relay/models"
)
@ -68,7 +67,7 @@ func Entrypoint(g *models.RelayConfig, v string) error {
worker := machineryServer.NewWorker(workerID.String(), globalConfig.JobConcurrency())
err = worker.Launch()
if err != nil {
fmt.Fprintln(os.Stderr, err)
logrus.Error(err)
}
return nil

View File

@ -11,6 +11,7 @@ import (
"time"
httpdate "github.com/Songmu/go-httpdate"
"github.com/sirupsen/logrus"
"github.com/yukimochi/httpsig"
)
@ -44,7 +45,7 @@ func sendActivity(inboxURL string, KeyID string, body []byte, publicKey *rsa.Pri
}
defer resp.Body.Close()
fmt.Println(inboxURL, resp.StatusCode)
logrus.Debug(inboxURL, resp.StatusCode)
if resp.StatusCode/100 != 2 {
return errors.New("Post " + inboxURL + ": " + resp.Status)
}