def buildLog(appName: String) = {
val file = s"${sys.env("HOME")}/builds/logs/${appName}.log"
val f = new File(file)
Enumerator.fromFile(f).map(new String(_))
}
我想在网页上显示一个滚动日志文件,我使用Enumerator.fromFile()
方法并将字节数组映射到字符串,但是我得到了一些奇怪的字符,比如
From xxx:yyy/zzz
* branch master -> FETCH_HEAD
Already up-to-date.
[0m[[0minfo[0m] [0mLoading project definition from /home/zzz/builds/sources/ops-ui/project[0m
[0m[[0minfo[0m] [0mSet current project to zzz (in build file:/home/zzz/builds/sources/ops-ui/)[0m
[0m[[32msuccess[0m] [0mTotal time: 0 s, completed 2013-12-30 17:38:53[0m
如何正确显示内容?