react-native-logs icon indicating copy to clipboard operation
react-native-logs copied to clipboard

Colour support for mapConsoleTransport or map support for consoleTransport

Open pke opened this issue 2 years ago • 1 comments

I recently wrote a test and wondered why my expectation that the logger.error would call console.error eventually did not work. Then I found out that consoleTransport uses console.log always and that to mimic console output traditionally one would have to use mapConsoleTransport

Now I have 2 questions:

  1. Why is consoleTransport using only console.log?
  2. Why isn't mapConsoleTransport not supporting colours.

Would it be possible to merge the 2 and have it map by default and use coloured output?

pke avatar Feb 19 '22 16:02 pke

Some consoles (e.g. chrome's) color the output according to the method used (console.warn, console.error, etc...) so I opted to create a separate transport without the colors...

alessandro-bottamedi avatar Jun 30 '22 13:06 alessandro-bottamedi

Reopen if you think it is still necessary.

alessandro-bottamedi avatar Jan 25 '24 13:01 alessandro-bottamedi

In VSCode when using mapConsoleTransport, it only colors the first part of the log message (LOG, DEBUG, WARN, or ERROR). Not the actual log message.

When using consoleTransport, it colors the whole message, but all of the logs are prefixed with "LOG" because it's just using console.log for all the log levels. This is confusing to look at because I'm logging things at different levels.

I'd like this feature, if possible.

Even if it's just a third transport (coloredMaptTransport) or something.

trydalch avatar Feb 06 '24 23:02 trydalch