Domanda

I am running my node app through forever and I save the log file. My problem is that the log is saved in a formatted manner. So colors end everything is saved. If I cat the code to the command line it looks nice but if I open it in any text editor I get the formatting strings as well.

^[[0;36mMongoose:^[[0m games.find({ progress: ^[[32m'waiting'^[[39m }) { fields: { _id: ^[[33m1^[[39m } }

What kind of format is this? And how can I visualize it properly in vim for example?

È stato utile?

Soluzione

You're seeing ANSI escape sequences.

There's ansifilter if you want to translate to plain text (strip escapes), HTML and some other (IIRC) formats.

There appears to be a Vim Script that appears to attempt something sensible with ANSI escapes here:

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top