Skip to content

Always print warnings and errors; clean up format - #2213

Merged
denik merged 21 commits into
mainfrom
DECO-24321---ErrAlreadyPrinted
Feb 7, 2025
Merged

Always print warnings and errors; clean up format#2213
denik merged 21 commits into
mainfrom
DECO-24321---ErrAlreadyPrinted

Conversation

@denik

@denikdenik commented Jan 23, 2025

Copy link
Copy Markdown
Contributor

Changes

  • Print warnings and errors by default.
  • Fix ErrAlreadyPrinted not to be logged at Error level.
  • Format log messages as "Warn: message" instead of "WARN" to make it more readable and in-line with the rest of the output.
  • Only print attributes (pid, mutator, etc) and time when the overall level is debug (so --debug output has not changed much).

Tests

  • Existing acceptance tests show how warning messages appear in various test case.
  • Added new test for --debug output.
  • Add sort_lines.py helper to avoid dependency on 'sort' which is locale-sensitive.

@denik
denikforce-pushed the DECO-24321---ErrAlreadyPrinted branch from 0f46e56 to efc48f1CompareJanuary 23, 2025 11:00
@denik
denikforce-pushed the DECO-24321---ErrAlreadyPrinted branch from efc48f1 to 131b414CompareJanuary 24, 2025 16:31
@denik
denik changed the base branch from main to denik/selftestJanuary 24, 2025 16:32
@denik
denikforce-pushed the DECO-24321---ErrAlreadyPrinted branch from 35ef576 to ff95005CompareJanuary 24, 2025 17:40
@denik
denik changed the base branch from denik/selftest to denik/acc-diagnosticsJanuary 24, 2025 17:40
@denikdenik changed the title WIP - loggingPrint warnings and higher by default; simplify formatJan 24, 2025
@denikdenik changed the title Print warnings and higher by default; simplify formatAlways print warnings and errors; simplify formatJan 24, 2025
@denik
denikforce-pushed the DECO-24321---ErrAlreadyPrinted branch from 4406d92 to 7d12edeCompareJanuary 24, 2025 19:20
@denik
denik changed the base branch from denik/acc-diagnostics to denik/selftestJanuary 24, 2025 19:21
Base automatically changed from denik/selftest to mainJanuary 27, 2025 08:17
@denik
denikforce-pushed the DECO-24321---ErrAlreadyPrinted branch from 7d12ede to b57aaf3CompareJanuary 27, 2025 08:33
@denik
denikforce-pushed the DECO-24321---ErrAlreadyPrinted branch from b57aaf3 to cf5d64bCompareJanuary 27, 2025 08:44
@denik
denikforce-pushed the DECO-24321---ErrAlreadyPrinted branch from cf5d64b to 6e50210CompareJanuary 27, 2025 08:56
@denikdenik changed the title Always print warnings and errors; simplify formatAlways print warnings and errors; clean up formatJan 27, 2025
@denik
denik marked this pull request as ready for review January 27, 2025 09:01
@denik
denik requested a review from pietern as a code ownerJanuary 27, 2025 09:01
@denik
denikforce-pushed the DECO-24321---ErrAlreadyPrinted branch from 5149c9a to f7e95e3CompareJanuary 31, 2025 21:42
@denik

denik commented Feb 4, 2025

Copy link
Copy Markdown
ContributorAuthor

I've silenced "unable to delete filer root" warning 547bd83 please take another look @pietern@andrewnester

denik added 21 commits February 7, 2025 12:06
This seems redundant - nothing is lost.
- remove time
- remove attrs unless level is debug
- replace $DEV_VERSION
- add acceptance test for --debug
Might be fixable with Locale setting (https://stackoverflow.com/a/39172728), but it's easier just not to depend on it.
…facts/.internal: unable to delete filer root to warning
The comment says it's intentional:
// We intentionally ignore the error because it is not critical to the deployment
err := client.Delete(ctx, ".", filer.DeleteRecursively)
if err != nil {
log.Errorf(ctx, "failed to delete %s: %v", uploadPath, err)
})

}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When incorporating diagnostics, we can evaluate whether it makes sense to use a different handler instead of having the conditionals here. In default operation, we don't care about the additional attrs, nor time, nor source locations, etc, but with additional verbosity we do. It could be easier to swap out the handler instead.

err := client.Delete(ctx, ".", filer.DeleteRecursively)
if err != nil {
log.Errorf(ctx, "failed to delete %s: %v", uploadPath, err)
log.Debugf(ctx, "failed to delete %s: %v", uploadPath, err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should evaluate the error classes in this condition and ignore the predictable errors (ie. the path doesn't exist) and return an error on real errors (like below).

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@denik@pietern@andrewnester@lennartkats-db