Socket
Socket
Sign inDemoInstall

@bearer/logger

Package Overview
Dependencies
1
Maintainers
4
Versions
126
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @bearer/logger

Bearer logger


Version published
Maintainers
4
Install size
109 kB
Created

Readme

Source

@bearer/logger

Version npm bundle size (scoped) Downloads/week License

Usage

We recommend to create a logger file within you project

// my-logger.ts
import debug from '@bearer/logger'

export default () => debug('my-package-name')

then in your app

import debug from 'path/to/my-logger'

const logger = debug()
logger('message to debug')
logger({ object: 'something' })

// sub logger

const subLogger = logger.extend('sub-feature')
subLogger('blablabl')

You'll need to set DEBUG=* to see all logs or DEBUG=bearer:my-package-name to see logs produced by your application.

Browser support

We assume you are writing a bearer integration.

views/src/my-component.tsx

import debug from '@bearer/logger'

const logger = debug('a-scope-you-provide')

class MyComponent {
  componentDidLoad() {
    logger('Loaded')
  }
}

if you want to see logs you must enable it by setting the localStorage.debug value from your console

Show all logs

localStorage.debug = '*'

Show bearer logs only

localStorage.debug = 'bearer:*'

Show your integration logs only

localStorage.debug = 'bearer:a-scope-you-provide:*'

Keywords

FAQs

Last updated on 03 Oct 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc