Set logging preferences via command line flags. Closes #20

This commit is contained in:
Gabe Kangas
2020-07-06 21:27:31 -07:00
parent 1133edf716
commit 259923b303
12 changed files with 38 additions and 22 deletions

View File

@@ -44,7 +44,7 @@ type IPFSStorage struct {
//Setup sets up the ipfs storage for saving the video to ipfs
func (s *IPFSStorage) Setup() error {
log.Println("Setting up IPFS for external storage of video. Please wait..")
log.Trace("Setting up IPFS for external storage of video. Please wait..")
s.gateway = ownconfig.Config.IPFS.Gateway
@@ -267,9 +267,9 @@ func (s *IPFSStorage) createIPFSInstance() (*icore.CoreAPI, *core.IpfsNode, erro
}
func (s *IPFSStorage) startIPFSNode() { //} icore.CoreAPI {
defer log.Println("IPFS node exited")
defer log.Debug("IPFS node exited")
log.Println("IPFS node is running")
log.Trace("IPFS node is running")
bootstrapNodes := []string{
// IPFS Bootstrapper nodes.

View File

@@ -30,7 +30,7 @@ type S3Storage struct {
//Setup sets up the s3 storage for saving the video to s3
func (s *S3Storage) Setup() error {
log.Println("Setting up S3 for external storage of video...")
log.Trace("Setting up S3 for external storage of video...")
s.s3Endpoint = config.Config.S3.Endpoint
s.s3Region = config.Config.S3.Region
@@ -62,9 +62,9 @@ func (s *S3Storage) Save(filePath string, retryCount int) (string, error) {
})
if err != nil {
log.Errorln("error uploading:", err.Error())
log.Trace("error uploading:", err.Error())
if retryCount < 4 {
log.Println("Retrying...")
log.Trace("Retrying...")
return s.Save(filePath, retryCount+1)
}
}