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

New logger subsystem (Bunyan) #835

Merged
merged 44 commits into from
Jul 25, 2018
Merged

New logger subsystem (Bunyan) #835

merged 44 commits into from
Jul 25, 2018

Conversation

noomorph
Copy link
Collaborator

@noomorph noomorph commented Jul 17, 2018

Changeset:

  1. Package change. detox-server is merged inside detox package.
  2. Behavior addition. When --record-logs value is set to all or failing, Detox also saves console logs as a pair of plain-text and JSON files in the location specified by --artifacts-location parameter. And now you can query JSON log files by jq, bunyan and similar tools.
  3. Fix. As a side effect of moving to bunyan and bunyan-debug-stream, some parts of log messages that have been swallowed by Jest previously, now are perfectly visible in a command line.
  4. CI: Detox own CI build change. If there's an exception in detox.init(), the build logs an error and exits. It makes build logs more compact and reasonable as the Jest behavior is to continue even when beforeAll fails. Although this is a hack, but it is marked with a todo item.
  5. CLI: Detox log levels verbose, silly and wss are deprecated. New --no-color option.
  6. CLI: Detox server now has loglevel and no-color params.
  7. Documentation is updated.

--loglevel info (default)

Before

screenshot from 2018-07-17 12-44-10

After

screenshot from 2018-07-17 12-41-35

--loglevel verbose (default)

Before

screenshot from 2018-07-17 12-44-52

After

screenshot from 2018-07-17 12-40-21

@noomorph noomorph requested a review from rotemmiz as a code owner July 17, 2018 09:46
Copy link
Member

@rotemmiz rotemmiz left a comment

Choose a reason for hiding this comment

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

  1. We should merge detox-common and detox-server into detox.
  2. 🎉

}

async onTerminate() {
if (this._artifactPlugins.length === 0) {
return;
}

log.info('ArtifactsManager', 'finalizing all artifacts, this can take some time');
log.info({ event: 'ARTIFACTS_FINALIZATION_START' }, 'finalizing the recorded artifacts...');
Copy link
Member

Choose a reason for hiding this comment

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

"this can take some time"

await this._emit('onTerminate', []);
await Promise.all(this._onIdleCallbacks.splice(0).map(this._executeIdleCallback));
await this._idlePromise;

await Promise.all(this._activeArtifacts.map(artifact => artifact.discard()));
await this._idlePromise;
this._artifactPlugins.splice(0);
log.info('ArtifactsManager', 'finalized all artifacts');
log.trace({ event: 'ARTIFACTS_FINALIZED' }, 'done');
}

async _emit(methodName, args) {
Copy link
Member

Choose a reason for hiding this comment

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

add logger inside emit instead of duplicating across ArtifactsManager.js

@@ -68,18 +73,21 @@ class SimulatorLogRecording extends Artifact {

_close() {
if (this._logStream) {

This comment was marked as outdated.

@@ -1,9 +1,11 @@
const _ = require('lodash');
const fs = require('fs');
Copy link
Member

Choose a reason for hiding this comment

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

unused, can remove this line

@noomorph noomorph force-pushed the noomorph/powerlogs branch from bf9cd5d to 0b7142e Compare July 24, 2018 11:48
@noomorph noomorph merged commit 78575f0 into master Jul 25, 2018
@rotemmiz rotemmiz changed the title [WIP] Provide queryable console logs in Detox Provide queryable console logs in Detox Jul 26, 2018
@rotemmiz rotemmiz changed the title Provide queryable console logs in Detox New logger subsystem (bunyan) Jul 26, 2018
@rotemmiz rotemmiz changed the title New logger subsystem (bunyan) New logger subsystem (Bunyan) Jul 26, 2018
@lock
Copy link

lock bot commented Jul 29, 2018

This thread has been automatically locked to prevent bumping of old threads. Instead, if you believe the issue still reproduces, please open a new issue and provide all the required information.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 29, 2018
@noomorph noomorph deleted the noomorph/powerlogs branch July 29, 2018 12:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants