diff options
author | 2021-10-11 05:37:33 -0700 | |
---|---|---|
committer | 2021-10-11 14:37:33 +0200 | |
commit | 083099a9575f8b2fac22c1d4a51a9dd0e2201243 (patch) | |
tree | d1787aa544679c433f797d2313ce532250fe574f /internal/db/bundb/admin.go | |
parent | Handle forwarded messages (#273) (diff) | |
download | gotosocial-083099a9575f8b2fac22c1d4a51a9dd0e2201243.tar.xz |
reference global logrus (#274)
* reference logrus' global logger instead of passing and storing a logger reference everywhere
* always directly use global logrus logger instead of referencing an instance
* test suites should also directly use the global logrus logger
* rename gin logging function to clarify that it's middleware
* correct comments which erroneously referenced removed logger parameter
* setting log level for tests now uses logrus' exported type instead of the string value, to guarantee error isn't possible
Diffstat (limited to 'internal/db/bundb/admin.go')
-rw-r--r-- | internal/db/bundb/admin.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/db/bundb/admin.go b/internal/db/bundb/admin.go index a2028f8f0..79ef4d142 100644 --- a/internal/db/bundb/admin.go +++ b/internal/db/bundb/admin.go @@ -24,6 +24,7 @@ import ( "crypto/rsa" "database/sql" "fmt" + "github.com/sirupsen/logrus" "net" "net/mail" "strings" @@ -86,7 +87,7 @@ func (a *adminDB) IsEmailAvailable(ctx context.Context, email string) (bool, db. func (a *adminDB) NewSignup(ctx context.Context, username string, reason string, requireApproval bool, email string, password string, signUpIP net.IP, locale string, appID string, emailVerified bool, admin bool) (*gtsmodel.User, db.Error) { key, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { - a.conn.log.Errorf("error creating new rsa key: %s", err) + logrus.Errorf("error creating new rsa key: %s", err) return nil, err } @@ -183,7 +184,7 @@ func (a *adminDB) CreateInstanceAccount(ctx context.Context) db.Error { WhereGroup(" AND ", whereEmptyOrNull("domain")) count, err := existsQ.Count(ctx) if err != nil && count == 1 { - a.conn.log.Infof("instance account %s already exists", username) + logrus.Infof("instance account %s already exists", username) return nil } else if err != sql.ErrNoRows { return a.conn.ProcessError(err) @@ -191,7 +192,7 @@ func (a *adminDB) CreateInstanceAccount(ctx context.Context) db.Error { key, err := rsa.GenerateKey(rand.Reader, 2048) if err != nil { - a.conn.log.Errorf("error creating new rsa key: %s", err) + logrus.Errorf("error creating new rsa key: %s", err) return err } @@ -226,7 +227,7 @@ func (a *adminDB) CreateInstanceAccount(ctx context.Context) db.Error { return a.conn.ProcessError(err) } - a.conn.log.Infof("instance account %s CREATED with id %s", username, acct.ID) + logrus.Infof("instance account %s CREATED with id %s", username, acct.ID) return nil } @@ -244,7 +245,7 @@ func (a *adminDB) CreateInstanceInstance(ctx context.Context) db.Error { return err } if exists { - a.conn.log.Infof("instance entry already exists") + logrus.Infof("instance entry already exists") return nil } @@ -269,6 +270,6 @@ func (a *adminDB) CreateInstanceInstance(ctx context.Context) db.Error { return a.conn.ProcessError(err) } - a.conn.log.Infof("created instance instance %s with id %s", domain, i.ID) + logrus.Infof("created instance instance %s with id %s", domain, i.ID) return nil } |