rust-lang / rust-log-analyzer

Analyzing Travis and Azure Pipelines logs to find encountered errors
MIT License
40 stars 27 forks source link

Direct raw log links to the ANSI to HTML script #31

Closed Mark-Simulacrum closed 4 years ago

Mark-Simulacrum commented 4 years ago

This script is hosted as a single index.html (in the gh-pages of this branch).

Sample URL with this PR: https://rust-lang.github.io/rust-log-analyzer/#https://dev.azure.com/rust-lang/e71b0ddf-dd27-435a-873c-e30f86eea377/_apis/build/builds/6949/logs/49

This does break the log links without JS enabled on the client, but the real URL is relatively easy to recover and this is an essentially free solution over implementing this server-side.

r? @pietroalbini

Centril commented 4 years ago

Sample URL with this PR: https://rust-lang.github.io/rust-log-analyzer/#https://dev.azure.com/rust-lang/e71b0ddf-dd27-435a-873c-e30f86eea377/_apis/build/builds/6949/logs/49

Can we tweak this to use a monospace font instead?

pietroalbini commented 4 years ago

This script is hosted as a single index.html (in the gh-pages of this branch).

Can we deploy the master branch to GitHub Pages instead? An issue with the gh-pages branch is a lot of tools just force push to it, and in the future we might forget an index.html is there. We could of course put it in a subdirectory -- an URL like https://rust-lang.github.io/rust-log-analyzer/log-viewer/#foo isn't that bad.


Also, with a quick search I found some libraries that take an ANSI-filled log and return a colorful version of it. How hard would it be to integrate them?

Mark-Simulacrum commented 4 years ago

I was unable to find a JS library that takes an ANSI log and returns colorful output; if you could point me to one then I can try and integrate it.

I've moved it to a subdirectory (I'll leave gh-pages for now and once we land this we can change config and such).

Mark-Simulacrum commented 4 years ago

Hm, actually, looks like you can't specify an arbitrary root, just /docs. Weird. But okay, I've moved it to log-viewer and we can just make master the root.

pietroalbini commented 4 years ago

I was unable to find a JS library that takes an ANSI log and returns colorful output; if you could point me to one then I can try and integrate it.

ansi_up doesn't seem bad.

Mark-Simulacrum commented 4 years ago

Okay, we now use ansi_up (note: the gh-pages doesn't work equivalently to this branch).

pietroalbini commented 4 years ago

Looks great! Thanks Mark!

alexcrichton commented 4 years ago

I'm not entirely sure why, but when I visit pages like https://rust-lang.github.io/rust-log-analyzer/log-viewer/#https://dev.azure.com/rust-lang/e71b0ddf-dd27-435a-873c-e30f86eea377/_apis/build/builds/7899/logs/45 in firefox I just see a blank page.

The developer console contains:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://dev.azure.com/rust-lang/e71b0ddf-dd27-435a-873c-e30f86eea377/_apis/build/builds/7899/logs/45. (Reason: CORS request did not succeed).
TypeError: NetworkError when attempting to fetch resource.

Would it be possible to have an unscrubbed link as well?

Mark-Simulacrum commented 4 years ago

Huh, interesting that I didn't/don't see the same despite using Firefox nightly and tracking protections set to strict and all. Maybe something to do with not being logged in the azure the same way?

But yeah, we can add a "raw" link too, shouldn't be too hard, in addition to this which'll be "full log" or something like that. I'll work on a PR today if I don't forget.