lambda-lite-logger
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

Lambda lite logger

NPM Version NPM Downloads License

📝 Yet another logger for Lambda

Why

I just want to pretty print any nest object param from log with some color..., nothing fancy.

Installation

npm i lambda-lite-logger

Usage

Basic

import { Logger } from "lambda--lite-logger";

const logger = new Logger();

// Pretty print nest object with 2 space by default
// 2021-1-6 19:31:6 [INFO] some data {
//   a: [
//     {
//       b: 1,
//       c: {
//         d: 2
//       }
//     }
//   ]
// }
logger.info("some data", { a: [{ b: 1, c: { d: 2 } }] });

More

const logger = new Logger({
  prettyPrint: false, // turn off prettyPrint, defaults to true
});

logger.debug("Only log process.env.NODE_ENV is not production"); // [DEBUG] ...
logger.warn("Warning"); // [WARN] warning
logger.error("Oh no"); // [ERROR] Oh no

logger.log("info", "low level API, just equal logger.info"); // [INFO] ...

Package Sidebar

Install

npm i lambda-lite-logger

Weekly Downloads

0

Version

0.0.6

License

MIT

Unpacked Size

16.6 kB

Total Files

8

Last publish

Collaborators

  • eastsun5566