在 SBT 中显示调试模式的时间戳? [英] Displaying timestamp for debug mode in SBT?
问题描述
我的sbt更新很慢,我想看看细节.
My sbt update is very slow, I'd like to see what happens in details.
所以,我有:
sbt --debug update > sbtupdate.log
问题是日志没有每一行的时间戳,如何启用?
The problem is that the log does not have timestamp for each line, how to enable it?
推荐答案
据我所知,仅使用 SBT 选项是不可能的.然而,这个问题提供了一个很好的解决方案.我将针对您的具体情况重新表述答案.以下所有内容均假设使用 Unix 操作系统,但应该可以将其调整为适用于 Windows 环境(如果使用 Cygwin 则很简单).
To my knowledge, it is not possible with only SBT options. However this question provides a good solution. I will rephrase the answer for your specific case. All the following supposes a Unix OS but it should be possible to adapt it for a Windows environment (and straightforward if using Cygwin).
首先,您需要一个名为 predate.sh
的脚本,其中包含:
First, you need a script called for example predate.sh
that contains:
#!/bin/bash
while read line ; do
echo "$(date): ${line}"
done
date
命令可以根据您的需要进行更改.然后,您必须使用 chmod u+x predate.sh
使该脚本可执行.
The date
command can be changed following your needs. Then, you must make this script executable with chmod u+x predate.sh
.
最后运行您的初始命令并将标准输出通过管道传输到我们的新脚本:
Finally run your initial command and pipe the standard output to our new script:
sbt --debug update | ./predate.sh > sbtupdate.log
请阅读链接的问题,其中包含有趣的其他回复.
Please read the linked question, it contains interesting other responses.
这篇关于在 SBT 中显示调试模式的时间戳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!