我在做什么的一点背景。我在一个工业控制器上通过不同的编程语言运行一些python脚本。由于我没有直接运行python脚本,所以我无法从终端查看任何打印或日志语句,因此我需要将详细日志发送到日志文件中。在
由于我们在调试时记录了大量的信息,所以我想找到一种方法,将coloredlogs
does这样的日志文件着色到打印到终端的日志上。我看了coloredlogs
,但它似乎只能在使用VIM
时将彩色日志打印到文件中。有人知道用python将彩色日志打印到文件中的方法吗?这个文件可以用wordpad这样的程序打开?(可能是.rtf
文件)。在
Tags:
可以使用
Windows PowerShell
Get-Content
函数打印包含ANSI escape sequences
的文件来为日志着色。在例如:
打开
Windows PowerShell
时,可以使用Get-Content .\spam.log
以彩色打印日志。在相关问题 更多 >
编程相关推荐