Skip to content

Commit 61e3b10

Browse files
committed
Update log viewer badge to display total log entries dynamically
1 parent 722ffa1 commit 61e3b10

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/logViewer.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,11 @@ export class LogViewerProvider implements vscode.TreeDataProvider<LogFile>, vsco
149149
return true;
150150
}
151151

152-
private updateBadge(count: number = 0): void {
153-
this.statusBarItem.text = `Magento Logs: ${count}`;
152+
private updateBadge(): void {
153+
const logPath = path.join(this.workspaceRoot, 'var', 'log');
154+
const logFiles = this.getLogFilesWithoutUpdatingBadge(logPath);
155+
const totalEntries = logFiles.reduce((count, file) => count + parseInt(file.description?.match(/\d+/)?.[0] || '0', 10), 0);
156+
this.statusBarItem.text = `Magento Log-Entries: ${totalEntries}`;
154157
}
155158

156159
dispose() {

0 commit comments

Comments
 (0)