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

Adds logging and ability to download logs #2194

Merged
merged 7 commits into from
Jul 13, 2020
Merged

Conversation

belcherj
Copy link
Contributor

@belcherj belcherj commented Jul 8, 2020

Fix

Stole liberally from https://github.com/Automattic/wp-desktop/pull/814/files.

This PR adds logging to the app. It also adds a menu item to download those logs. This will be helpful in diagnosing issues.

Test

  1. Download installers from Circle
  2. Install
  3. Download logs

Release

Adds logging and ability to download logs

@belcherj belcherj self-assigned this Jul 8, 2020
@belcherj belcherj requested review from dmsnell and codebykat July 8, 2020 17:23
@belcherj belcherj changed the title Add menu item to download logs Adds logging and ability to download logs Jul 8, 2020
desktop/logger/archiver.js Outdated Show resolved Hide resolved
if (!options || typeof options !== 'object') options = {};

const formatMessageWithMeta = (info) => {
const args = info[Symbol.for('splat')];
Copy link
Member

Choose a reason for hiding this comment

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

what's the reason for a Symbol here and what's the reason for splat?

Choose a reason for hiding this comment

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

It's been a while so my recollection is a little fuzzy - wish I added a comment when I initially wrote this. 😅 Per the Winston docs, Symbol.for('splat') is how splat arguments are extracted. I believe this piece of logic handles the case where splat arguments could be populated with an array like [undefined] or some such, leading to some funky output.

I think this is moot if splatting is entirely not used (e.g. log.info("message: %s", x)), although you may encounter it even with log.info("message: ", x), but not 100 percent sure - I may have been working around some default behavior. You may need to verify output with/without this piece of logic.

desktop/logger/index.js Outdated Show resolved Hide resolved
desktop/logger/archiver.js Outdated Show resolved Hide resolved
desktop/logger/archiver.js Outdated Show resolved Hide resolved
desktop/logger/index.js Outdated Show resolved Hide resolved
desktop/logger/index.js Outdated Show resolved Hide resolved
desktop/logger/index.js Outdated Show resolved Hide resolved
desktop/logger/index.js Outdated Show resolved Hide resolved
@belcherj belcherj merged commit 9a0d3bf into develop Jul 13, 2020
@belcherj belcherj deleted the add/download-logs branch July 13, 2020 19:56
@codebykat codebykat added this to the 1.21 milestone Jul 23, 2020
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.

4 participants