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

Retrieve a run context inside a pre/post script #4274

Open
Amerousful opened this issue Sep 12, 2024 · 3 comments
Open

Retrieve a run context inside a pre/post script #4274

Amerousful opened this issue Sep 12, 2024 · 3 comments

Comments

@Amerousful
Copy link
Contributor

Feature/improvement

According to the fact that a pre/post-script runs for each URL, it would be useful to have the ability to retrieve the context of the run, such as the URL.
My real-life example is that I have logic in a pre-script with try-catch, and there's no way to log details about which specific URL the error occurred on.


fileWithUrls.txt:

https://www.sitespeed.io/
https://www.sitespeed.io/examples/
https://www.sitespeed.io/documentation/
https://www.sitespeed.io/blog/

Command for run:

sitespeed.io --target fileWithUrls.txt --preScript someScript.mjs 
@soulgalore
Copy link
Member

Thank you @Amerousful for creating this. I need to think a couple of days how we can fix this the easiest way.

@Amerousful
Copy link
Contributor Author

Many thanks. I wouldn't call it a fix, it's more about improvements)

@soulgalore
Copy link
Member

That part of the code is something I'm not proud of so it's time to clean that up and make it possible to add some smarter logging. I don't like when you cannot log what you need :)

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

No branches or pull requests

2 participants