I am trying to prepend a timestamp to all lines in stdout and stderr.
(我正在为stdout和stderr中的所有行添加时间戳。)
However I do not want to redirect either of them to a file. (但是,我不想将它们中的任何一个重定向到文件。)
This command is being run in a script by a process manager (pm2) which will then log stdout and stderr to their respective file. (进程管理器(pm2)正在脚本中运行此命令,然后它将stdout和stderr记录到它们各自的文件中。)
I am trying to modify the stream (without combining them) and insert the timestamp before is logged by pm2. (我正在尝试修改流(不合并它们)并在pm2记录之前插入时间戳。)
I can get either of them working in isolation but run into issues modifying both. (我可以让他们两个都孤立地工作,但是遇到修改两者的问题。)
I appreciate any assistance you can provide. (感谢您提供的任何帮助。)
Here is my somewhat working code
(这是我的一些工作代码)
python3.6 ./bot.py > >(gawk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0 }') 2> >(gawk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0 }')
ask by scorch855 translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…