@@ -48,7 +48,8 @@ export class LogViewerProvider implements vscode.TreeDataProvider<LogFile>, vsco
4848 public getLogFiles ( dir : string ) : LogFile [ ] {
4949 if ( this . pathExists ( dir ) ) {
5050 const files = fs . readdirSync ( dir ) ;
51- const logFiles = files . map ( file => {
51+ this . updateBadge ( files . length ) ;
52+ return files . map ( file => {
5253 const filePath = path . join ( dir , file ) ;
5354 const lineCount = this . getLineCount ( filePath ) ;
5455 const logFile = new LogFile ( `${ file } (${ lineCount } )` , vscode . TreeItemCollapsibleState . Collapsed , {
@@ -60,18 +61,8 @@ export class LogViewerProvider implements vscode.TreeDataProvider<LogFile>, vsco
6061 logFile . children = this . getLogFileLines ( filePath ) ;
6162 return logFile ;
6263 } ) ;
63- const totalEntries = logFiles . reduce ( ( count , logFile ) => {
64- return count + ( logFile . children ?. reduce ( ( childCount , child ) => childCount + ( child . children ?. length || 0 ) , 0 ) || 0 ) ;
65- } , 0 ) ;
66- const errorEntries = logFiles . reduce ( ( count , logFile ) => {
67- return count + ( logFile . children ?. reduce ( ( childCount , child ) => {
68- return childCount + ( child . children ?. filter ( grandChild => grandChild . label . toLowerCase ( ) . includes ( 'error' ) ) . length || 0 ) ;
69- } , 0 ) || 0 ) ;
70- } , 0 ) ;
71- this . updateBadge ( totalEntries , errorEntries ) ;
72- return logFiles ;
7364 } else {
74- this . updateBadge ( 0 , 0 ) ;
65+ this . updateBadge ( 0 ) ;
7566 return [ ] ;
7667 }
7768 }
@@ -158,9 +149,8 @@ export class LogViewerProvider implements vscode.TreeDataProvider<LogFile>, vsco
158149 return true ;
159150 }
160151
161- private updateBadge ( totalEntries : number = 0 , errorEntries : number = 0 ) : void {
162- const entryText = totalEntries === 1 ? 'Magento Log-Entry' : 'Magento Log-Entries' ;
163- this . statusBarItem . text = `${ entryText } : ${ totalEntries } (${ errorEntries } errors)` ;
152+ private updateBadge ( count : number = 0 ) : void {
153+ this . statusBarItem . text = `Magento Logs: ${ count } ` ;
164154 }
165155
166156 dispose ( ) {
0 commit comments