Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@onflow/util-logger

Package Overview
Dependencies
Maintainers
13
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onflow/util-logger

Logger for FCL-JS

  • 1.3.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12K
increased by26.52%
Maintainers
13
Weekly downloads
 
Created
Source

@onflow/util-logger

Logger for FCL-JS.

Status

  • Last Updated: March 30 2022
  • Stable: Yes
  • Risk of Breaking Change: No

Install

npm install --save @onflow/util-logger

Usage

Logger Levels

NameValue
error1
warn2
log3
info4
debug5
import * as logger from "@onflow/util-logger"

// This will fire if the config "logger.level" value is set to the error level or above
logger.log({
  title: "Title of error", 
  message: "Message body", 
  level: logger.LEVELS.error
})

Deprecation

This package also exposes a useful method for logging deprecation warnings via log.deprecate. The function accepts an object with the following keys as its parameters.

  • pkg (optional) - The package which the deprecated feature belongs to (i.e. FCL/SDK, @onflow/util-invariant, etc.). If not provided it defaults to an empty string and will not show in the notice.
  • subject (optional) - The feature that is being deprecated (i.e. "Passing a start and end into getEvents").
  • transition (optional) - The URL to the transition guide for the deprecation
  • level (optional) - The logger level of the deprecation notice (default LEVELS.warn)
  • message (optional) - An additional message to provide the user about the deprecation. Will ap
  • callback (optional) -

Deprecation notice format:

 `${pkg} Deprecation Notice
============================

${subject} is deprecated and will cease to work in future releases of ${pkg}.
${message}
You can learn more (including a guide on common transition paths) here: ${transition}

============================`

The lines with subject, message, and transition will not appear if these values are not provided.

Example usage:

import * as logger from "@onflow/util-logger"

logger.log.deprecate({
  pkg: "FCL/SDK",
  subject: "Passing a start and end into getEvents",
  transition:
    "https://github.com/onflow/flow-js-sdk/blob/master/packages/sdk/TRANSITIONS.md#0005-deprecate-start-end-get-events-builder",
})

FAQs

Package last updated on 27 Nov 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc