Skip to content

Commit

Permalink
Fix errcheck issues in server/channels/app/platform/log.go (mattermos…
Browse files Browse the repository at this point in the history
…t#29349)

Co-authored-by: Ben Schumacher <[email protected]>
  • Loading branch information
AulakhHarsh and hanzei authored Nov 26, 2024
1 parent 924bef8 commit edbcb24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion server/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ issues:
channels/app/permissions_test.go|\
channels/app/platform/helper_test.go|\
channels/app/platform/license.go|\
channels/app/platform/log.go|\
channels/app/platform/searchengine.go|\
channels/app/platform/service.go|\
channels/app/platform/service_test.go|\
Expand Down
12 changes: 8 additions & 4 deletions server/channels/app/platform/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,17 @@ func (ps *PlatformService) RemoveUnlicensedLogTargets(license *model.License) {
timeoutCtx, cancelCtx := context.WithTimeout(context.Background(), time.Second*10)
defer cancelCtx()

ps.logger.RemoveTargets(timeoutCtx, func(ti mlog.TargetInfo) bool {
if err := ps.logger.RemoveTargets(timeoutCtx, func(ti mlog.TargetInfo) bool {
return ti.Type != "*targets.Writer" && ti.Type != "*targets.File"
})
}); err != nil {
mlog.Error("Failed to remove log targets", mlog.Err(err))
}

ps.notificationsLogger.RemoveTargets(timeoutCtx, func(ti mlog.TargetInfo) bool {
if err := ps.notificationsLogger.RemoveTargets(timeoutCtx, func(ti mlog.TargetInfo) bool {
return ti.Type != "*targets.Writer" && ti.Type != "*targets.File"
})
}); err != nil {
mlog.Error("Failed to remove notification log targets", mlog.Err(err))
}
}

func (ps *PlatformService) GetLogsSkipSend(rctx request.CTX, page, perPage int, logFilter *model.LogFilter) ([]string, *model.AppError) {
Expand Down

0 comments on commit edbcb24

Please sign in to comment.