No warn logs (#3024)

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

- [x] 🧹 Tech Debt/Cleanup

#### Test Plan

- [x] 💪 Manual
This commit is contained in:
Keepers 2023-04-05 11:43:02 -06:00 committed by GitHub
parent 7dda79a97c
commit fac5a0f3d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 20 deletions

View File

@ -29,7 +29,7 @@ linters-settings:
forbid:
# Don't allow creating contexts without logging in tests. Use an ignore
# lower down to ensure usages of this outside of tests aren't reported.
- 'context\.(Background|TODO)(# tests should use tester\.NewContext )?'
- 'context\.(Background|TODO)(# tests should use tester\.NewContext)?'
# Don't allow use of path as it hardcodes separator to `/`.
# Use filepath instead.
- '\bpath\.(Ext|Base|Dir|Join)'
@ -38,10 +38,12 @@ linters-settings:
# Don't allow use of testify suite directly. Use one of the wrappers from
# tester/suite.go instead. Use an ignore lower down to exclude packages
# that result in import cycles if they try to use the wrapper.
- 'suite\.Suite(# tests should use one of the Suite wrappers in tester package )?'
- 'suite\.Suite(# tests should use one of the Suite wrappers in tester package)?'
# All errors should be constructed and wrapped with the clues package.
# String formatting should be avoided in favor of structured errors (ie: err.With(k, v)).
- '(errors|fmt)\.(New|Stack|Wrap|Error)f?\((# error handling should use clues pkg)?'
# Avoid Warn-level logging in favor of Info or Error.
- 'Warn[wf]?\((# logging should use Info or Error)?'
lll:
line-length: 120
revive:

View File

@ -258,11 +258,10 @@ func (c Contacts) GetAddedAndRemovedItemIDs(
if len(os.Getenv("CORSO_URL_LOGGING")) > 0 {
gri, err := builder.ToGetRequestInformation(ctx, options)
if err != nil {
logger.Ctx(ctx).Errorw("getting builder info", "error", err)
logger.CtxErr(ctx, err).Error("getting builder info")
} else {
logger.Ctx(ctx).
With("user", user, "container", directoryID).
Warnw("builder path-parameters", "path_parameters", gri.PathParameters)
Infow("builder path-parameters", "path_parameters", gri.PathParameters)
}
}

View File

@ -292,11 +292,10 @@ func (c Events) GetAddedAndRemovedItemIDs(
if len(os.Getenv("CORSO_URL_LOGGING")) > 0 {
gri, err := builder.ToGetRequestInformation(ctx, nil)
if err != nil {
logger.Ctx(ctx).Errorw("getting builder info", "error", err)
logger.CtxErr(ctx, err).Error("getting builder info")
} else {
logger.Ctx(ctx).
With("user", user, "container", calendarID).
Warnw("builder path-parameters", "path_parameters", gri.PathParameters)
Infow("builder path-parameters", "path_parameters", gri.PathParameters)
}
}

View File

@ -303,11 +303,10 @@ func (c Mail) GetAddedAndRemovedItemIDs(
if len(os.Getenv("CORSO_URL_LOGGING")) > 0 {
gri, err := builder.ToGetRequestInformation(ctx, options)
if err != nil {
logger.Ctx(ctx).Errorw("getting builder info", "error", err)
logger.CtxErr(ctx, err).Error("getting builder info")
} else {
logger.Ctx(ctx).
With("user", user, "container", directoryID).
Warnw("builder path-parameters", "path_parameters", gri.PathParameters)
Infow("builder path-parameters", "path_parameters", gri.PathParameters)
}
}

View File

@ -299,11 +299,13 @@ func (suite *OneDriveSuite) TestCreateGetDeleteFolder() {
ctx, flush := tester.NewContext()
defer flush()
t := suite.T()
folderIDs := []string{}
folderName1 := "Corso_Folder_Test_" + common.FormatNow(common.SimpleTimeTesting)
folderElements := []string{folderName1}
gs := loadTestService(t)
var (
t = suite.T()
folderIDs = []string{}
folderName1 = "Corso_Folder_Test_" + common.FormatNow(common.SimpleTimeTesting)
folderElements = []string{folderName1}
gs = loadTestService(t)
)
pager, err := PagerForSource(OneDriveSource, gs, suite.userID, nil)
require.NoError(t, err, clues.ToCore(err))
@ -317,11 +319,13 @@ func (suite *OneDriveSuite) TestCreateGetDeleteFolder() {
defer func() {
for _, id := range folderIDs {
ictx := clues.Add(ctx, "folder_id", id)
// deletes require unique http clients
// https://github.com/alcionai/corso/issues/2707
err := DeleteItem(ctx, loadTestService(t), driveID, id)
err := DeleteItem(ictx, loadTestService(t), driveID, id)
if err != nil {
logger.Ctx(ctx).Warnw("deleting folder", "id", id, "error", err)
logger.CtxErr(ictx, err).Errorw("deleting folder")
}
}
}()

View File

@ -280,7 +280,7 @@ func filterUserPermissions(ctx context.Context, perms []models.Permissionable) [
if gv2.GetDevice() != nil {
logm.With("application_id", ptr.Val(gv2.GetDevice().GetId()))
}
logm.Warn("untracked permission")
logm.Info("untracked permission")
}
// Technically GrantedToV2 can also contain devices, but the

View File

@ -7,5 +7,5 @@ import (
)
func signalDump(ctx context.Context) {
logger.Ctx(ctx).Warn("cannot send signal on Windows")
logger.Ctx(ctx).Error("cannot send signal on Windows")
}