New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@swear-js/logger

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swear-js/logger

Logger for swear-js

  • 2.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

🍭 Swear JS

@swear-js/logger


npm npm type definitions npm bundle size GitHub

Logger package for SwearJS state manager

Installation

$ npm install @swear-js/logger

or in case you are using Yarn:

$ yarn add @swear-js/logger

Usage


You can pass your custom logger to the store, or use @swear-js/logger. Swear-js logger usage:

import { createStore } from "@swear-js/core";
import { swearLogger } from "@swear-js/logger";

const store = createStore({ onPatch: swearLogger });

Tagging

Architecture of SwearJs is built that way, patches know anything about action from where mutation was triggered. Didn't expect that, soon will be trying to fix it. Instead you can use tagging while mutating. Mutate function gets string tag as a second argument.

export const countSwear = createSwear('counter', defaultState, (mutate) => ({
    decrease: () => {
        // You can also access previous value like this
        mutate((prev) => prev - 1, 'SOME TAG THAT WILL BE SHOWN IN LOGS');
    }
}));

Keywords

FAQs

Package last updated on 29 May 2022

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