Socket
Book a DemoInstallSign in
Socket

@map-colonies/js-logger

Package Overview
Dependencies
Maintainers
10
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@map-colonies/js-logger

Javascript and typescript logger for MapColonies based on pino

latest
Source
npmnpm
Version
3.0.2
Version published
Maintainers
10
Created
Source

js logger

JavaScript and TypeScript logger for MapColonies based on pino.

API documentation

Check the autogenerated documentation here.

Usage

import jsLogger from '@map-colonies/js-logger';

const logger = jsLogger();

logger.info('hello world');

logger.error({hello: 'world'});

Logging errors

One of the features of the logger is the ability to parse error objects and format them accordingly. To allow the logger to identify the error, add it to the log object under the err key.

try {
  // complex code
} catch (error) {
  logger.error({msg: "oh noes", err: error});
}

For more detailed usage check the pino documentation.

Configuration

nametypedefault valuedescription
enabledbooleantruedetermines if logging is enabled
levelstring'info'specifies the logging level
redactarrayundefineddefines paths to redact from log output
hooksobjectundefinedhooks for customizing log behavior
baseobject{pid: process.pid, hostname: os.hostname}base properties to include in log output
mixinfunctionundefinedfunction to add custom properties to log output
prettyPrintbooleanfalseenables pretty-printing of log output
pinoCallerbooleanfalseincludes the caller's file and line number in log output

FAQs

Package last updated on 03 Aug 2025

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