Socket
Book a DemoInstallSign in
Socket

@binden/logger

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@binden/logger

A simple logger (based on pino)

latest
Source
npmnpm
Version
2.0.3
Version published
Maintainers
1
Created
Source

@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 });

Keywords

logger

FAQs

Package last updated on 08 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts