putyourlightson / craft-blitz

Intelligent static page caching for creating lightning-fast sites with Craft CMS.
https://putyourlightson.com/plugins/blitz
Other
147 stars 35 forks source link

Verbose CLI output #642

Closed justenh closed 3 months ago

justenh commented 3 months ago

Feature Request

Provide more detailed output during CLI execution.

For example, running craft blitz/cache/generate-site 1, it would be great to see which pages are being processed at any given time. This would have the added benefit of providing a way to troubleshoot particularly lengthy generations, or exceptions that cause the command to fail. Ideally, these would be written directly to the CLI during execution so our deployment scripts would capture them as the output of the call. Below is a rough outline of the type of information that might be useful.

Generating Blitz cache for 3 uris.
1. Updated cache "/newsroom/page" (500ms)
2. Updated cache "/newsroom/page-2" (1500ms)
3. Removed cache "/newsroom/page-3" (100ms)

Generated Blitz cache for 18/18 uris
2 updates
1 removals
total time: 2m10s

Additionally, running any CLI that combines multiple commands such as blitz/cache/refresh could output each step of the command being executed. Currently, the refresh command seems to hang with no output.

If the output would cause a slowdown in the execution of the command, it could be flagged on and off. Our preference would be not to hide it behind debug, but instead have it accept a flag of --verbose or something similar.

Plugin Version

No response

bencroker commented 3 months ago

Thanks for the suggestion. I added a verbose output mode to blitz/cache console commands in https://github.com/putyourlightson/craft-blitz/commit/097dfc06fb28063eef5d327210e7fe75fee5dd79 that can be activated by adding a --verbose flag. It doesn’t quite report everything in your outline, but it lists URLs as they are generated, noting any errors in red.

You can test this by running ddev composer require "putyourlightson/craft-blitz:dev-develop as 4.14.0".

justenh commented 3 months ago

Thanks @bencroker! I Just ran through a quick test, and the output is very helpful. I'll continue to test and let you know if anything pops up. Appreciate your quick attention to this request!

bencroker commented 3 months ago

Released in 4.14.0.