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

custom-log

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

custom-log - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

custom-log.min.js.save

50

custom-log.js

@@ -8,4 +8,9 @@ // Generated by CoffeeScript 1.9.1

customLog = function(init) {
var Log, fn, level, log, message, prefixMsg;
var CUSTOM_LOG, Log, fn, level, log, logInstance, message, prefixMsg;
CUSTOM_LOG = 'custom-log: ';
Log = (function() {
var log;
log = console.log;
function Log(level1, message1) {

@@ -15,2 +20,3 @@ var name, prop;

this.message = message1 != null ? message1 : '';
this.assert = bind(this.assert, this);
this.enable = bind(this.enable, this);

@@ -23,3 +29,3 @@ this.disable = bind(this.disable, this);

if (_this.enabled) {
return console.log.apply(console, (ref = [_this.message]).concat.apply(ref, arguments));
return log.apply(console, (ref = [_this.message]).concat.apply(ref, arguments));
}

@@ -38,3 +44,3 @@ };

this.enabled = false;
return console.log('CUSTOM-LOG: ' + this.level + ' has been disabled.');
return log(CUSTOM_LOG + '.' + this.level + ' has been disabled');
};

@@ -44,5 +50,25 @@

this.enabled = true;
return console.log('CUSTOM-LOG: ' + this.level + ' is now enabled.');
return log(CUSTOM_LOG + '.' + this.level + ' is now enabled');
};
Log.prototype.assert = function(predicate, description) {
if (description == null) {
description = '';
}
if (description) {
description = '"' + description + '"';
} else if (typeof predicate === 'string') {
description = predicate;
}
if (typeof predicate === 'string') {
predicate = eval(predicate);
}
if (predicate) {
predicate = 'TRUE';
} else {
predicate = 'FALSE';
}
return this.log('\n\t' + customLog.assertMessage + '(' + description + ') == ' + predicate + '\n');
};
return Log;

@@ -54,9 +80,13 @@

}
log = new Log('log', prefixMsg).log;
logInstance = new Log('log', prefixMsg);
log = logInstance.log;
if (typeof init === 'object') {
fn = function(level, message) {
if (level === 'log') {
return log = new Log(level, message).log;
} else {
return log[level] = new Log(level, message).log;
switch (level) {
case 'log':
return logInstance.message = message;
case 'assert':
return customLog.assertMessage = message;
default:
return log[level] = new Log(level, message).log;
}

@@ -72,2 +102,4 @@ };

customLog.assertMessage = 'Assert: ';
if ((typeof define !== "undefined" && define !== null) && ('function' === typeof define) && define.amd) {

@@ -74,0 +106,0 @@ define('customLog', [], function() {

2

custom-log.min.js

@@ -1,1 +0,1 @@

(function(){"use strict";var e,n=function(e,n){return function(){return e.apply(n,arguments)}};e=function(e){var t,o,i,l,s,u;if(t=function(){function e(e,t){var o,i;this.level=null!=e?e:"log",this.message=null!=t?t:"",this.enable=n(this.enable,this),this.disable=n(this.disable,this),this.enabled=!0,this.log=function(e){return function(){var n;return e.enabled?console.log.apply(console,(n=[e.message]).concat.apply(n,arguments)):void 0}}(this);for(o in this)i=this[o],this.hasOwnProperty(o)&&"log"!==o&&(this.log[o]=i)}return e.prototype.disable=function(){return this.enabled=!1,console.log("CUSTOM-LOG: "+this.level+" has been disabled.")},e.prototype.enable=function(){return this.enabled=!0,console.log("CUSTOM-LOG: "+this.level+" is now enabled.")},e}(),"string"==typeof e&&(u=e),l=new t("log",u).log,"object"==typeof e){o=function(e,n){return"log"===e?l=new t(e,n).log:l[e]=new t(e,n).log};for(i in e)s=e[i],o(i,s)}return l},"undefined"!=typeof define&&null!==define&&"function"==typeof define&&define.amd?define("customLog",[],function(){return e}):"undefined"!=typeof module?module.exports=e:"undefined"!=typeof window&&(window.customLog=e)}).call(this);
(function(){"use strict";var customLog,bind=function(e,t){return function(){return e.apply(t,arguments)}};customLog=function(init){var CUSTOM_LOG,Log,fn,level,log,logInstance,message,prefixMsg;if(CUSTOM_LOG="custom-log: ",Log=function(){function Log(e,t){var n,i;this.level=null!=e?e:"log",this.message=null!=t?t:"",this.assert=bind(this.assert,this),this.enable=bind(this.enable,this),this.disable=bind(this.disable,this),this.enabled=!0,this.log=function(e){return function(){var t;return e.enabled?log.apply(console,(t=[e.message]).concat.apply(t,arguments)):void 0}}(this);for(n in this)i=this[n],this.hasOwnProperty(n)&&"log"!==n&&(this.log[n]=i)}var log;return log=console.log,Log.prototype.disable=function(){return this.enabled=!1,log(CUSTOM_LOG+"."+this.level+" has been disabled")},Log.prototype.enable=function(){return this.enabled=!0,log(CUSTOM_LOG+"."+this.level+" is now enabled")},Log.prototype.assert=function(predicate,description){return null==description&&(description=""),description?description='"'+description+'"':"string"==typeof predicate&&(description=predicate),"string"==typeof predicate&&(predicate=eval(predicate)),predicate=predicate?"TRUE":"FALSE",this.log("\n "+customLog.assertMessage+"("+description+") == "+predicate+"\n")},Log}(),"string"==typeof init&&(prefixMsg=init),logInstance=new Log("log",prefixMsg),log=logInstance.log,"object"==typeof init){fn=function(e,t){switch(e){case"log":return logInstance.message=t;case"assert":return customLog.assertMessage=t;default:return log[e]=new Log(e,t).log}};for(level in init)message=init[level],fn(level,message)}return log},customLog.assertMessage="Assert: ","undefined"!=typeof define&&null!==define&&"function"==typeof define&&define.amd?define("customLog",[],function(){return customLog}):"undefined"!=typeof module?module.exports=customLog:"undefined"!=typeof window&&(window.customLog=customLog)}).call(this);
{
"name": "custom-log",
"version": "0.1.5",
"version": "0.1.6",
"description": "A tiny flexible logger",

@@ -5,0 +5,0 @@ "main": "custom-log.min.js",

custom-log
==========
A tiny (~1kb) flexible logger, very basic, simple and fast. Will add some features over time.
A tiny (~2kb) flexible logger, very basic, simple and fast. Will add some features over time.

@@ -6,0 +6,0 @@ For browser, node, amd.

Sorry, the diff of this file is not supported yet

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