Skip to content

Commit 276f753

Browse files
committed
feat: better linking, document samples
1 parent da48ee2 commit 276f753

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

php-error-log-viewer.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ public function parse( $raw ) {
143143
}
144144

145145
public function link_vscode_files( $string ) {
146-
$string = preg_replace_callback( ' $([A-Z]:)?([\\\/][^:()]+)[:\(]([0-9]+)\)?$', array( $this, 'vscode_link_filter' ), $string );
147-
$string = preg_replace_callback( ' $([A-Z]:)?([\\\/][^:()]+) on line ([0-9]+)\)?$', array( $this, 'vscode_link_filter' ), $string );
146+
$string = preg_replace_callback( '$([A-Z]:)?([\\\/][^:(\s]+)(?: on line |[:\(])([0-9]+)\)?$', array( $this, 'vscode_link_filter' ), $string );
148147
return $string;
149148
}
150149

@@ -175,7 +174,7 @@ public function replace_callback( $arr ) {
175174
$this->content[ $err_id ] = array();
176175
$this->content[ $err_id ]['id'] = $err_id; // err_id.
177176
$this->content[ $err_id ]['cnt'] = 1; // counter.
178-
$this->index[] = $err_id;
177+
$this->index[] = $err_id;
179178
} else { // we already have that error...
180179
$this->content[ $err_id ]['cnt']++; // counter.
181180
}

readme.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,12 @@ vscode_path_search='/srv/www/current/'
4444
;
4545
vscode_path_replace='C:/my-repository/'
4646
```
47+
48+
## Linking
49+
The log viewer extracts paths and line numbers from your log file (transforms them) and creates vscode links.
50+
It works for the following samples:
51+
52+
- <mark>/srv/www/web/app/themes/defaultspace/functions.php(605)</mark>: get_post_card(Object(WP_Post), Array)
53+
- PHP Fatal error: Uncaught TypeError: ..., called in <mark>C:\foo\bar/themes/defaultspace/functions.php on line 605</mark>
54+
- ... and defined in <mark>C:\foo\bar/themes/defaultspace/functions.php:63</mark>
55+

0 commit comments

Comments
 (0)