1.0.2 • Published 9 years ago

log-safe v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
9 years ago

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' );