npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@onflow/util-logger

v1.3.2

Published

Logger for FCL-JS

Downloads

56,372

Readme

@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

| Name | Value | | ------- | ----- | | error | 1 | | warn | 2 | | log | 3 | | info | 4 | | debug | 5 |

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",
})