pure-console-logger
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

pure-console-logger

Version Downloads License

NPM

Yet antoher logger, nobody asked for.

Super simple & provides good human debugable logs to the console.

Easy to use, small focus - very useful for small "DIY" projects.

2021-10-28T08:37:53.458Z INFO: [MAIN] Starting server -
2021-10-28T08:37:53.541Z DEBUG: [SERVER] Server started and listening on port 3000 -

Usage

Usage example

A simple example how to use this module. Copied from here example.ts

import { Logger, setLoglevel } from "pure-console-logger";
const logger = new Logger(__filename);

setLoglevel("INFO"); // Sets the loglevel globally
logger.debug("This is not logged!")
logger.info(JSON.stringify({ foo: "bar" }));
logger.warn("This is a warning!", { meta: "data", appended: "to the log string" });
logger.error("Oops!");
logger.error(new Error("something bad happended"));

const loggerWithStaticInfo = new Logger("custom name", { user: "zuse" });
loggerWithStaticInfo.info("Goodbye!");

Loglevels

PRIO NAME EMOJI
1 ERROR 🚫
2 WARN ⚠️
3 INFO ℹ️
4 DEBUG 👾

CONTRIBUTORS

Feel free to contribute - pull requests and issues are welcome :)

LICENSE

MIT License

SEE LICENSE FILE

Package Sidebar

Install

npm i pure-console-logger

Weekly Downloads

9

Version

1.0.2

License

MIT

Unpacked Size

6.37 kB

Total Files

5

Last publish

Collaborators

  • flowr-es