Previewing *.log files
When loggers in my apps pipe logs to a file, I make sure they’re usually in the format:
<timestamp> <level> <application-name> <JSON>
and they are saved to a *.log
file.
I hardly preview the entire file, preferring to tail it as the application runs, but when I need to, I find the a combination of the following vscode extensions useful:
- https://marketplace.visualstudio.com/items?itemName=ryeden.condenser
- https://marketplace.visualstudio.com/items?itemName=imgss.json-in-log
With Log Condeser, I can CTRL + '
to begin filtering a log file with a regular expression or just plain text e.g. “Debug” will show me all logs in the Debug level, and CTRL + SHIFT + '
to revert to the original content.
And with Json in Log, I can hover over the JSON content on each line to preview it.