rnx-kit/packages/console
Tommy Nguyen 945a5d03dc
chore: bump @types/node to 16.0 (#1065)
2022-02-08 12:52:40 +00:00
..
src feat: introduce common console logger (#317) 2021-06-23 10:34:29 -07:00
test docs(console): add README and tests (#378) 2021-07-09 14:17:51 +02:00
CHANGELOG.md chore: clean up Beachball artifacts in change logs (#924) 2021-12-02 16:31:54 +00:00
README.md docs(console): add README and tests (#378) 2021-07-09 14:17:51 +02:00
package.json chore: bump @types/node to 16.0 (#1065) 2022-02-08 12:52:40 +00:00
tsconfig.json chore(security): scope internal scripts package to prevent hijacking (#830) 2021-11-09 20:21:15 +01:00

README.md

@rnx-kit/console

Build npm version

@rnx-kit/console is a simple console logger that is a subset of the logger in @react-native-community/cli-tools. It is used by Metro plugins to ensure that log lines are consistent with @react-native-community/cli.

Ideally, we should be using the reporter that is passed to Metro but we don't have access to it from the customSerializer hook. The next best thing would be to use @react-native-community/cli-tools but it includes a bunch of other tools and we cannot take a dependency on any single version since we need to support multiple versions of react-native (and hence multiple versions of @react-native-community/cli-tools).

Other libraries, such as just-task-logger, were also considered. However, the purpose of this package is to match with the output of @react-native-community/cli. just-task-logger in particular uses its own colour scheme and doesn't allow configuring them to match the colour scheme.

Install

yarn add @rnx-kit/console --dev

Usage

import { error, info, warn } from "@rnx-kit/console";

error("This is an error message");
info("This is an informational message");
warn("This is a warning");