Skip to content

Conversation

@connorjclark
Copy link
Collaborator

This enables logging from PSI.

Maybe we should log all the artifacts too?

Tests awaiting feedback.

Note: this PR is building on this (Googlers only).

@brendankenny
Copy link
Contributor

at some point we were going to delete all of this because the artifacts are returned by the module now. Can lr use that instead of this logging business?

@connorjclark
Copy link
Collaborator Author

connorjclark commented May 20, 2019

Discussed offline a bit.

We considered changing the LR entry to return the entire RunnerResult, but that would involve some annoying parsing changes in LR.

Realized we can just put all of the runnerResult.artifacts on the LR return value, without touching the asset saving module. I can revert all the changes there, unless it's better now?

Copy link
Member

@paulirish paulirish left a comment

Choose a reason for hiding this comment

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

Let's put up the LR-side of this for review as well?

It'd be easier to handle both at once.

* @return {Promise<void>}
* @return {Promise<Array<{name: string, contents: string}>>}
*/
async function logAssets(artifacts, audits) {
Copy link
Member

Choose a reason for hiding this comment

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

once we have the LR-side to process your nested artifacts, I think we can delete this logAssets function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done


if (logAssets) {
await assetSaver.logAssets(results.artifacts, results.lhr.audits);
const assetsToLog =
Copy link
Member

Choose a reason for hiding this comment

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

this refactor doesn't seem to be a win. if anything, logAssets() should call its own private prepare method, but due to other comments, i dont think we'll end up needing this code anyhow.

// When LR is called with |internal: {keep_raw_response: true, save_lighthouse_assets: true}|,
// this code will log artifacts to raw_response.artifacts.
if (logAssets) {
const reportObj = JSON.parse(runnerResult.report);
Copy link
Member

Choose a reason for hiding this comment

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

let's use runnerResult.lhr instead of parsing the string back

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.

3 participants