I have a pm2 node.js process running. Everything is good, console logs and errors display very well in the terminal.
But as soon as I open logs file with vim or nano rather than view them with pm2 logs
, I get a mess !
It looks like that :
01/07/2021 09:10:19 GMT+00:00: ^[[0mPOST /auth/refresh ^[[33m404^[[0m 4.601 ms - 74^[[0m
01/07/2021 09:10:20 GMT+00:00: ^[[0mPOST /auth/refresh ^[[33m404^[[0m 0.868 ms -
01/07/2021 09:10:28 GMT+00:00: ^[[0mPOST /auth/ ^[[32m200^[[0m 163.059 ms - 677^[[0m
01/07/2021 09:10:28 GMT+00:00: ^[[0mGET /messages/info/by-role/3 ^[[32m200^[[0m 8.993 ms - 586^[[0m
01/07/2021 09:10:28 GMT+00:00: ^[[0mGET /exchanges/lasts/9?limit=5 ^[[32m200^[[0m 10.884 ms - 484^[[0m
I do think it's because of colors. They are only well interpreted by the terminal but are weirdly stored. One of the solution could be to remove those colors but I was wondering if there is a way to just display them nicely in vim, nano or another text editor.
vim
cannot display them as colors. Tryless -R
– phd