Failed to display colour in console
Closed this issue · 8 comments
Hello, I am using the default example. I have also reviewed some of the previous issues about displaying colour though I have failed to view the logs in the console in colour. I am also using typescript in my project.
Below is the implementation
import { logger, consoleTransport } from "react-native-logs";
const defaultConfig = {
severity: "debug",
transport: consoleTransport,
transportOptions: {
color: "ansi", // custom option that color consoleTransport logs
},
levels: {
debug: 0,
info: 1,
warn: 2,
error: 3,
},
async: true,
dateFormat: "time",
printLevel: true,
printDate: true,
enabled: true,
};
var log = logger.createLogger(defaultConfig);
Hi, which console do you use? for the chrome console try to change the transportOptions.color
option:
import { logger, consoleTransport } from "react-native-logs";
const defaultConfig = {
transportOptions: {
colors: "web" // or "ansi",
},
};
var log = logger.createLogger(defaultConfig);
I am using terminal
I've tested with terminal (MacOS X Catalina) and I can see all colors without problems with the "ansi" option.
What kind of console do you have on terminal, ZSH?
Yes, i am using zsh
Does anyone else experience the same problem?
I m facing the same issue. I m using Terminal (Version 2.11 (440)) on Mac Big Sur 11.4 Beta.
i tried web and ansi but couldn't see the color.
one thing I found is the key name is colors not the color . when I use ansi, i could see the color, web doesnt seem to work:
transportOptions: {
colors: "ansi"
}
Sorry, there was an error in the documentation, the right option is colors
, set it to web
for chrome and ansi
for the terminal. Let me know if the problem persists and I will reopen the issue.