Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Increase logging #2351

Merged
merged 2 commits into from
Oct 24, 2024
Merged

fix: Increase logging #2351

merged 2 commits into from
Oct 24, 2024

Conversation

taratatach
Copy link
Member

Bring back the debugging logs we're used to so we can help our users.

Please make sure the following boxes are checked:

  • PR is not too big
  • it improves UX & DX in some way
  • it includes unit tests matching the implementation changes
  • it includes scenarios matching a new behaviour or has been manually tested
  • it includes relevant documentation

@taratatach taratatach self-assigned this Oct 23, 2024
Base automatically changed from deps/upgrade-electron-builder to master October 23, 2024 14:25
  When switching our logger from `bunyan` to `winston` we changed the
  level from `trace` to `info` by mistake, thus decreasing the quantity
  of useful logs we get when running the app.

  We just change the level back to `trace`.
  We made a mistake in the function listing log files to send the last
  one as paths returned by `fs.readdir()` are sorted alpabetically and
  log files' names contain numbers which need `String.localeCompare` to
  be sorted properly.

  e.g. when we have new log file names and old ones at the same time, we
  can have the following order :

  1. `logs.txt`             # old format for current log file
  2. `logs.txt.0`           # old format for previous day log file
  3. `logs.txt.1`           # old format
  4. `logs.txt.2`           # old format
  5. `logs.txt.2024-10-22`  # new format for previous day log file
  6. `logs.txt.2024-10-23`  # new format for current day log file
  7. `logs.txt.3`           # old format

  In this case, when trying to send the latest log file with a support
  request, we'd send `logs.txt.3` as it is the latest one in
  alpabetical order when we intended to send `logs.txt.2024-10-23`.

  By using `String.localeCompare` with its `numeric: true` option, we
  make sure numbers in strings are sorted in a numerical order :

  1. `logs.txt`             # old format for current log file
  2. `logs.txt.0`           # old format for previous day log file
  3. `logs.txt.1`           # old format
  4. `logs.txt.2`           # old format
  5. `logs.txt.3`           # old format
  6. `logs.txt.2024-10-22`  # new format for previous day log file
  7. `logs.txt.2024-10-23`  # new format for current day log file
@taratatach taratatach merged commit 637c3a4 into master Oct 24, 2024
10 of 16 checks passed
@taratatach taratatach deleted the fix/sending-useful-logs branch October 24, 2024 11:04
Sign up for free to 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.

1 participant