Get-Content $logFile -wait | ForEach { if ($_.Contains("[OK]")){ Write-Host -ForegroundColor Green $_ } elseif ($_.Contains("[FAIL]")){ Write-Host -ForegroundColor Red $_ } elseif ($_.Contains("[INFO]")){ Write-Host -ForegroundColor Yellow $_ } else { Write-Host $_ } }
这个日志文件将永远不会包含超过100行,所有相关的应用程序之一。15服务。现在,我只是使用日志文件上的上述尾部将这100行输出到屏幕上。
但我真正想做的是显示一个有15行的表,当我从日志中获得新行时,不断更新该表,以在我从日志中获得新信息时显示新信息。
我试过搜索这样的表格示例,但没有找到。有可能吗?如果有,请给我一个关于它的链接。