2.0.2 • Published 1 year ago

@binden/logger v2.0.2

Weekly downloads
-
License
AGPL-3.0-only
Repository
github
Last release
1 year ago

@binden/logger CI Status version Known Vulnerabilities code style: prettier Contributor Covenant semantic-release Conventional Commits GitHub top language node version npm downloads License

A simple logger (based on pino).

By default, the logging level is equal to the value of the BINDEN_LOG_LEVEL environmental variable.

BINDEN_LOG_LEVEL=trace

Installation

npm install @binden/logger

Usage

import { Logger } from "@binden/logger";
const logger = new Logger({ level: Logger.getLevel("OTHER_ENV_NAME") });

or using the default import

import log from "@binden/logger";
  • .fatal()
log.fatal("Bad error. Exiting...", { id: 1, someinfo: { a: 2 } });
  • .error()
try {
  doSomething();
} catch (error) {
  log.error("Something bad happened in the `doSomething`", { error });
}
  • .warn()
if (connection) {
  workWithConnection();
} else {
  log.warn("The connection has not been established", { reason });
}
  • .info()
server.on("listening", (port) => {
  log.info(`The server is listening`, { port });
});
  • .debug()
websocket.on("message", (message) => {
  log.debug("Received a message", { message });
});
  • .trace()
log.trace("Array length", { length: arr.length });
2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.9

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago