Log-Highlight
Log-Highlight copied to clipboard
Map server path to client path
I'm running a development server within a Vagrant VM. Clicking the blow link will take me to a directory that does not exist on my local client, but within the VM.
[31-Mar-2018 19:09:41 UTC] PHP Notice: Undefined property: stdClass::$plugin in /srv/www/example/htdocs/wp-includes/class-wp-list-util.php on line 150
It would be great to be able to map these remote paths to my local dev directory.
"path_mapping": {
"/srv/www/example" : "/Users/jan/vvv/www/example"
}
I just noticed that the default package shows a definitions when you hover over the paths in the log:

Clicking these links takes me to the correct file and line. It would still be great if I could just single click on the file path in Log Highlight, but this is close enough!
Ok, turned out that popup doesn't match the files the way I want it. It will look at the content of the current project and try to guess which file I'd want based on its contents rather than take the literal file referenced in the log file.
This ended up bugging me enough that I wrote a short gulp task for it that watches a given log file and replaces the server path with my local path.
As a temporary workaround, I created /srv in my root, and a symlink www inside it that points to my ~/Sites dir. Inside the site directory (eg 'cea' or 'mywebsite.com') I created another symlink to go to the correct folder - it looks like you might not need this, but mine was current -> site.
This allowed me to open the files referenced by the log.
However, I would really like the feature originally described by @jancbeck - thank you @poucotm
I'm currently also working with the workaround that @robrecord describes. The downside of this is that Sublime treats the files under my /srv symlink as different from than the ones in my project. That's OK most of the time if I just want to quickly jump into a class or function referenced by the log and see what is going on there, but of course it would be much better if this would not open a new file tab.
@jancbeck , Currently, it looks impossible to change a path mapping, because the package uses result_file_regex
. It is just one of view settings. The way is to change the mechanism calling a link file instead of result_file_regex
.