seanmonstar / intel

I need more intel!
http://seanmonstar.github.io/intel/
Mozilla Public License 2.0
202 stars 26 forks source link

Add formatter option to strip ANSI escape codes #18

Closed jameswyse closed 10 years ago

jameswyse commented 10 years ago

I tend to add colours to my log messages to make them easier to read during development (plus I'm a sucker for pretty console output), but it's not ideal to keep the colours around when logging to a file or database.

I've added a new strip option to the formatter that runs the message and args through chalk.stripColor. It also disables colorize if both are enabled at once - cause that's just silly.

Thoughts?

seanmonstar commented 10 years ago

You mean adding additional coloring to a message? like intel.debug('foo %s baz', chalk.red('bar'));?

jameswyse commented 10 years ago

Yep! Great for console but you end up with lines like this in log files:

DEBUG: [app] foo bar baz

:scream:

seanmonstar commented 10 years ago

Sure, makes sense.

seanmonstar commented 10 years ago

I'm sorry I didn't think of this sooner: why not just run chalk.stripColor() on the formatted string before returning? Faster, easier.

jameswyse commented 10 years ago

haha yeah totally, I've done exactly that in 9c4a572. Much easier.

Sorry about that, I blame my broken coffee machine :/

Let me know if I've missed anything!

seanmonstar commented 10 years ago

Awesome! I should have noticed the first time, but I was in-between Titanfall matches.

Can you squash the commits into 1? Then I'll merge it in :D