setting log level for tests now uses logrus' exported type instead of the string value, to guarantee error isn't possible

This commit is contained in:
R. Aidan Campbell 2021-10-10 17:20:53 -07:00
commit 62a891e7f6
No known key found for this signature in database
GPG key ID: 0985399E9CD6A99B
2 changed files with 4 additions and 2 deletions

View file

@ -19,6 +19,7 @@
package media
import (
"github.com/sirupsen/logrus"
"github.com/superseriousbusiness/gotosocial/internal/log"
"io/ioutil"
"testing"
@ -37,7 +38,7 @@ type MediaUtilTestSuite struct {
// SetupSuite sets some variables on the suite that we can use as consts (more or less) throughout
func (suite *MediaUtilTestSuite) SetupSuite() {
// doesn't use testrig.InitTestLog() helper to prevent import cycle
err := log.Initialize("trace")
err := log.Initialize(logrus.TraceLevel.String())
if err != nil {
panic(err)
}

View file

@ -19,12 +19,13 @@
package testrig
import (
"github.com/sirupsen/logrus"
"github.com/superseriousbusiness/gotosocial/internal/log"
)
// InitTestLog sets the global logger to trace level for logging
func InitTestLog() {
err := log.Initialize("trace")
err := log.Initialize(logrus.TraceLevel.String())
if err != nil {
panic(err)
}