Commit eb162488 authored by ci's avatar ci
Browse files

improve logging

parent 439ff911
...@@ -2,6 +2,7 @@ package main ...@@ -2,6 +2,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/lbryio/lbry.go/extras/errors"
"math/rand" "math/rand"
"os" "os"
"time" "time"
...@@ -194,7 +195,7 @@ func ytSync(cmd *cobra.Command, args []string) { ...@@ -194,7 +195,7 @@ func ytSync(cmd *cobra.Command, args []string) {
) )
err := sm.Start() err := sm.Start()
if err != nil { if err != nil {
ytUtils.SendErrorToSlack(err.Error()) ytUtils.SendErrorToSlack(errors.FullTrace(err))
} }
ytUtils.SendInfoToSlack("Syncing process terminated!") ytUtils.SendInfoToSlack("Syncing process terminated!")
} }
...@@ -384,7 +384,7 @@ func (s *Sync) stopAndUploadWallet(e *error) { ...@@ -384,7 +384,7 @@ func (s *Sync) stopAndUploadWallet(e *error) {
} }
} }
func logShutdownError(shutdownErr error) { func logShutdownError(shutdownErr error) {
logUtils.SendErrorToSlack("error shutting down daemon: %v", shutdownErr) logUtils.SendErrorToSlack("error shutting down daemon: %s", errors.FullTrace(shutdownErr))
logUtils.SendErrorToSlack("WALLET HAS NOT BEEN MOVED TO THE WALLET BACKUP DIR") logUtils.SendErrorToSlack("WALLET HAS NOT BEEN MOVED TO THE WALLET BACKUP DIR")
} }
...@@ -699,7 +699,7 @@ func (s *Sync) startWorker(workerNum int) { ...@@ -699,7 +699,7 @@ func (s *Sync) startWorker(workerNum int) {
err := s.waitForNewBlock() err := s.waitForNewBlock()
if err != nil { if err != nil {
s.grp.Stop() s.grp.Stop()
logUtils.SendErrorToSlack("something went wrong while waiting for a block: %v", err) logUtils.SendErrorToSlack("something went wrong while waiting for a block: %s", errors.FullTrace(err))
break break
} }
} else if util.SubstringInSlice(err.Error(), []string{ } else if util.SubstringInSlice(err.Error(), []string{
...@@ -711,7 +711,7 @@ func (s *Sync) startWorker(workerNum int) { ...@@ -711,7 +711,7 @@ func (s *Sync) startWorker(workerNum int) {
err := s.walletSetup() err := s.walletSetup()
if err != nil { if err != nil {
s.grp.Stop() s.grp.Stop()
logUtils.SendErrorToSlack("failed to setup the wallet for a refill: %v", err) logUtils.SendErrorToSlack("failed to setup the wallet for a refill: %s", errors.FullTrace(err))
break break
} }
} else if strings.Contains(err.Error(), "Error in daemon: 'str' object has no attribute 'get'") { } else if strings.Contains(err.Error(), "Error in daemon: 'str' object has no attribute 'get'") {
...@@ -746,7 +746,7 @@ func (s *Sync) startWorker(workerNum int) { ...@@ -746,7 +746,7 @@ func (s *Sync) startWorker(workerNum int) {
} }
err = s.Manager.apiConfig.MarkVideoStatus(s.YoutubeChannelID, v.ID(), videoStatus, existingClaimID, existingClaimName, err.Error(), &existingClaimSize, 0) err = s.Manager.apiConfig.MarkVideoStatus(s.YoutubeChannelID, v.ID(), videoStatus, existingClaimID, existingClaimName, err.Error(), &existingClaimSize, 0)
if err != nil { if err != nil {
logUtils.SendErrorToSlack("Failed to mark video on the database: %s", err.Error()) logUtils.SendErrorToSlack("Failed to mark video on the database: %s", errors.FullTrace(err))
} }
} }
break break
...@@ -937,7 +937,7 @@ func (s *Sync) processVideo(v video) (err error) { ...@@ -937,7 +937,7 @@ func (s *Sync) processVideo(v video) (err error) {
s.AppendSyncedVideo(v.ID(), true, "", summary.ClaimName, summary.ClaimID, newMetadataVersion, *v.Size()) s.AppendSyncedVideo(v.ID(), true, "", summary.ClaimName, summary.ClaimID, newMetadataVersion, *v.Size())
err = s.Manager.apiConfig.MarkVideoStatus(s.YoutubeChannelID, v.ID(), VideoStatusPublished, summary.ClaimID, summary.ClaimName, "", v.Size(), 2) err = s.Manager.apiConfig.MarkVideoStatus(s.YoutubeChannelID, v.ID(), VideoStatusPublished, summary.ClaimID, summary.ClaimName, "", v.Size(), 2)
if err != nil { if err != nil {
logUtils.SendErrorToSlack("Failed to mark video on the database: %s", err.Error()) logUtils.SendErrorToSlack("Failed to mark video on the database: %s", errors.FullTrace(err))
} }
return nil return nil
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment