@kirklin/logger
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

logger

A simple JavaScript logging library that allows you to log messages with levels (Trace, Debug, Info, Warn, and Error) and optional fields and custom colors.

  • Built for node and the browser
  • Use groups in the browser to reduce clutter

Install

pnpm i @kirklin/logger

Example Usage

import { field, logger } from "@kirklin/logger";

logger.info("Loading container",
	field("msg", 1),
	field("msg2", {"key":value}));

Formatting

By default, the logger uses a different formatter depending on whether it detects it is running in the browser or not. A custom formatter can be set:

import { logger, Formatter } from "@kirklin/logger";

class MyFormatter extends Formatter {
	// implementation ...
}

logger.formatter = new MyFormatter();

License

MIT License © 2022-PRESENT Kirk Lin

Readme

Keywords

none

Package Sidebar

Install

npm i @kirklin/logger

Weekly Downloads

320

Version

0.0.2

License

MIT

Unpacked Size

26.9 kB

Total Files

6

Last publish

Collaborators

  • kirklin