🚀 DAY 3 OF LAUNCH WEEK: Introducing Webhook Events for Pull Request Scans.Learn more →
Socket
Book a DemoInstallSign in
Socket

@poap-xyz/poap-logger

Package Overview
Dependencies
Maintainers
5
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@poap-xyz/poap-logger

A logger for POAP

latest
Source
npmnpm
Version
2.0.2
Version published
Maintainers
5
Created
Source

💻 POAP Logger 📜

A logger with a simple facade to use in the POAP ecosystem.

The main branch is for version 2.x of the logger.
Version 1.x has its own branch.

Usage

Setup

Install from NPM repository. There are two implementations: winston and pino. Both work in the same way, depending on which one you are using, install it alongside this package.

yarn add @poap-xyz/poap-logger winston
# OR
yarn add @poap-xyz/poap-logger pino

Logger Creation

Use the factory to create new instances of a logger.

import { PoapLoggerFactory } from '@poap-xyz/poap-logger';

const logger = PoapLoggerFactory.createLoggerInstance({
  metadata: {/*METADATA*/}
});

Where METADATA is a key value pair object where you add extra properties you want to log, eg:

const logger = PoapLoggerFactory.createLoggerInstance({
  metadata: {
    requestId: request.headers["requestid"],
    requestUrl: request.url,
    source: "POAP-Logger-Parent",
  },
});

A minimum level can be set on creation. All logs that are lower priority than the given level will be discarted.

import { PoapLoggerLevel } from '@poap-xyz/poap-logger';

const logger = PoapLoggerFactory.createLoggerInstance({
  level: PoapLoggerLevel.WARNING,
});

By default the implementation is going to be auto detected depending on the packages defined in your package.json but it can be overriden.

import { PoapLoggerType } from '@poap-xyz/poap-logger';

const logger = PoapLoggerFactory.createLoggerInstance({
  type: PoapLoggerType.PINO_LOGGER,
});

Child Loggers

Create a child logger to override or combine parent child metadata:

const newLogger = logger.child({
  moreMetadata1: "More meta", // Will be added
  source: "POAP-Logger-Child" // Will override parent's source prop
});

License

ISC © POAP

FAQs

Package last updated on 02 Jun 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