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

log-safe

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

log-safe

Keep console logging out of production

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

log-safe

Browser console logging with URL based constraints

log-safe is a small utility that helps keep console logging out of your production environment

Prerequisites

CommonJS/Browserify

Initialization

Params

log-safe must be initialized with an include RegEx, exlcude RegEx, or both

Example:

var logger = require( 'log-safe' )({
    include: /.*\?debug=true/,
    exclude: /www\.productiondomain\.com.*/
});
include

If the current URL matches this RegEx, your message will be logged.

exclude

If the current URL does not match this RegEx, your message will be logged.

Usage

Once you have initialized log-safe, use it just like the native console object (but without exposing end users to your logging!).

logger.log( 'this is a log' );
logger.warn( 'this is a warn' );
logger.error( 'this is an error' );

FAQs

Package last updated on 02 Feb 2015

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