You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

mad-logs

Package Overview
Dependencies
Maintainers
1
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mad-logs - npm Package Compare versions

Comparing version

to
12.0.0

11

lib/node.d.ts

@@ -1,2 +0,5 @@

/**************************************** TYPE DEFINITIONS ****************************************/
/**
* For cases where the value truly can be anything (in contrast to cases where any is used out
* of laziness or to temporarily avoid excessive complexity.
*/
export declare type RealAny = any;

@@ -51,3 +54,2 @@ export interface InspectFn {

}
/******************************************** HELPERS *********************************************/
/**

@@ -63,5 +65,4 @@ * Preconfigured version of Node's util.inspect function

export declare const inspect: (obj: any, isHidden?: boolean) => string;
/********************************************* EXPORT *********************************************/
/**
* Create a special log for the current file
* Create a special log for the current file.
*

@@ -79,3 +80,1 @@ * Produces dynamic object w functions that also operate as objects at each

export { buildFileTagString as buildFileTag };
import colors from 'colors';
export { colors };

@@ -6,7 +6,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/******************************************** IMPORTS *********************************************/
/*------------------------------------- THIRD-PARTY MODULES --------------------------------------*/
var env_var_helpers_1 = require("env-var-helpers");
var util_1 = require("util");
var detect_node_1 = __importDefault(require("detect-node"));
/************************ ENSURE MODULE ONLY LOADED IN CORRECT ENVIRONMENT ************************/
/*----------------------- ENSURE MODULE ONLY LOADED IN CORRECT ENVIRONMENT -----------------------*/
// Throw error & crash the app if attempt made to load this sub-module outside Node

@@ -18,3 +18,3 @@ if (!detect_node_1.default && !process.env.mocha) {

}
/******************************************** HELPERS *********************************************/
/*------------------------------------------- HELPERS --------------------------------------------*/
/**

@@ -53,15 +53,17 @@ * Preconfigured version of Node's util.inspect function

* @param {RealAny[]} args Items to log (true RealAny)
* @return {RealAny} Last argument given to function (pass it through unchanged)
* @return Last argument given to function (pass it through unchanged)
*/
var passThruLog = function (logFn) { return function () {
var anyArgsWLastArgT = [];
for (var _i = 0; _i < arguments.length; _i++) {
anyArgsWLastArgT[_i] = arguments[_i];
}
if (anyArgsWLastArgT.length > 0) {
logFn(anyArgsWLastArgT);
return anyArgsWLastArgT[anyArgsWLastArgT.length - 1];
}
logFn('');
}; };
var passThruLog = function (logFn) {
return function () {
var anyArgsWLastArgT = [];
for (var _i = 0; _i < arguments.length; _i++) {
anyArgsWLastArgT[_i] = arguments[_i];
}
if (anyArgsWLastArgT.length > 0) {
logFn(anyArgsWLastArgT);
return anyArgsWLastArgT[anyArgsWLastArgT.length - 1];
}
logFn('');
};
};
/**

@@ -75,3 +77,3 @@ * Outer function returns a reusable 'inspector' function for returning

*
* @return {Function} Inspector function with the following params:
* @return Inspector function with the following params:
* | @param {string|Object} msgOrObj Message describing obj to be inspected (in the 2nd arg)

@@ -120,3 +122,5 @@ * | @param {string|Object} obj? Obj for inspection, if 1st arg contained a message str

var objInfoString = exports.inspect(msgOrObj);
var name = Object.keys(msgOrObj).find(function (key) { return key === 'name'; }) ? " " + msgOrObj.name + ": " : '';
var name = Object.keys(msgOrObj).find(function (key) { return key === 'name'; })
? " " + msgOrObj.name + ": "
: '';
if (doAutoLog)

@@ -239,5 +243,5 @@ console.log(TAG + " ~>" + name, objInfoString);

};
/********************************************* EXPORT *********************************************/
/*-------------------------------------------- EXPORT --------------------------------------------*/
/**
* Create a special log for the current file
* Create a special log for the current file.
*

@@ -263,4 +267,2 @@ * Produces dynamic object w functions that also operate as objects at each

exports.buildFileTag = build_file_tag_string_1.buildFileTagString;
var colors_1 = __importDefault(require("colors"));
exports.colors = colors_1.default;
//# sourceMappingURL=node.js.map
/// <reference path="../typings/index.d.ts" />
import colors from '@colors/colors';
/****

@@ -11,11 +12,11 @@ *

export declare const serverStyles: {
blueBgWhite: any;
magentaBgWhite: any;
cyanBgBlack: any;
whiteBgYellow: any;
whiteBgBlack: any;
blackBgCyanItalic: any;
blackBgGreen: any;
blackBgYellow: any;
blackBgWhite: any;
blueBgWhite: colors.Color;
magentaBgWhite: colors.Color;
cyanBgBlack: colors.Color;
whiteBgYellow: colors.Color;
whiteBgBlack: colors.Color;
blackBgCyanItalic: colors.Color;
blackBgGreen: colors.Color;
blackBgYellow: colors.Color;
blackBgWhite: colors.Color;
};

@@ -7,3 +7,3 @@ "use strict";

/// <reference path="./typings/index.d.ts" />
var colors_1 = __importDefault(require("colors"));
var colors_1 = __importDefault(require("@colors/colors"));
/****

@@ -10,0 +10,0 @@ *

import { isoStyles } from './src/isomorphic-styles';
/**************************************** TYPE DEFINITIONS ****************************************/
/**

@@ -7,3 +6,2 @@ * Available log levels in the application

export declare type LogLevels = keyof Log['inspector'];
/******************************************* LOG OBJECT *******************************************/
/**

@@ -67,3 +65,2 @@ * Isomorphic Log object

}
/******************************************** FACTORY *********************************************/
/**

@@ -70,0 +67,0 @@ * Construct a new Log object & return it

@@ -10,8 +10,9 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/************************************** THIRD-PARTY MODULES ***************************************/
/*------------------------------------- THIRD-PARTY MODULES --------------------------------------*/
var env_var_helpers_1 = require("env-var-helpers");
var detect_node_1 = __importDefault(require("detect-node"));
/*--------------------------------------- PROJECT MODULES ----------------------------------------*/
var isomorphic_styles_1 = require("./src/isomorphic-styles");
exports.Styles = isomorphic_styles_1.isoStyles;
var detect_node_1 = __importDefault(require("detect-node"));
/**************************************** HELPERS & CONFIG ****************************************/
/*--------------------------------------- HELPERS & CONFIG ---------------------------------------*/
var bookend = "\n***************\n";

@@ -22,3 +23,3 @@ /**

*/
var _showInspectRes = function (obj, styler, filename, inspectFn) {
var _showInspectRes = function (obj, styler, _filename, inspectFn) {
var output;

@@ -42,3 +43,3 @@ if (typeof obj === "undefined") {

};
/******************************************* LOG OBJECT *******************************************/
/*------------------------------------------ LOG OBJECT ------------------------------------------*/
/**

@@ -219,3 +220,3 @@ * Isomorphic Log object

exports.Log = Log;
/******************************************** FACTORY *********************************************/
/*------------------------------------------- FACTORY --------------------------------------------*/
/**

@@ -222,0 +223,0 @@ * Construct a new Log object & return it

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var padEnd = require('string.prototype.padend');
/*------------------------------------- THIRD-PARTY MODULES --------------------------------------*/
var string_prototype_padend_1 = __importDefault(require("string.prototype.padend"));
/*------------------------------------------- HELPERS --------------------------------------------*/
/**
* Type guard to detect functions
*/
var isFunction = function (val) { return ({}.toString.call(val) == '[object Function]'); };
/***************************************** ERROR MESSAGES *****************************************/
/*---------------------------------------- ERROR MESSAGES ----------------------------------------*/
var colourizerTypeError = '[mad-logs] 2nd arg to buildFileTagString must be a function from the' +

@@ -51,3 +59,3 @@ ' colors module, a number (representing r-pad length), or be excluded';

var colourWidth = colourizer ? colouredFilename.length - filename.length : 0;
var TAG = padEnd("" + colouredFilename, padlen + colourWidth, ' ');
var TAG = string_prototype_padend_1.default("" + colouredFilename, padlen + colourWidth, ' ');
return TAG;

@@ -54,0 +62,0 @@ };

@@ -6,4 +6,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/*------------------------------------- THIRD-PARTY MODULES --------------------------------------*/
var detect_node_1 = __importDefault(require("detect-node"));
/*------------------------------------------- HELPERS --------------------------------------------*/
var cssInverse = "filter: invert(100%); -moz-filter: invert(100%); -webkit-filter: invert(100%);";
/*-------------------------------------------- EXPORT --------------------------------------------*/
// prettier-ignore

@@ -10,0 +13,0 @@ /**

@@ -17,3 +17,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
/*------------------------------------- THIRD-PARTY MODULES --------------------------------------*/
var detect_node_1 = __importDefault(require("detect-node"));
/*--------------------------------------- PROJECT MODULES ----------------------------------------*/
var isomorphic_styling_1 = require("./isomorphic-styling");

@@ -20,0 +22,0 @@ // prettier-ignore

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

/************************************** THIRD-PARTY IMPORTS ***************************************/
import 'mocha';

@@ -10,17 +10,16 @@ "use strict";

process.env.mocha = true;
/************************************** THIRD-PARTY IMPORTS ***************************************/
/*------------------------------------- THIRD-PARTY MODULES --------------------------------------*/
require("mocha");
var chai_1 = require("chai");
var test_console_1 = require("test-console");
/************************************ IMPORT FILE TO BE TESTED ************************************/
/*----------------------------------- IMPORT FILE TO BE TESTED -----------------------------------*/
var node_1 = require("../node");
/******************************************** LOGGING *********************************************/
var colors_1 = __importDefault(require("colors"));
/*------------------------------------------- LOGGING --------------------------------------------*/
var colors_1 = __importDefault(require("@colors/colors"));
var TAG = node_1.buildFileTag('mad-logs-node.test.ts', colors_1.default.bgMagenta.white);
/******************************************** HELPERS *********************************************/
/*------------------------------------------- HELPERS --------------------------------------------*/
/**
* Prevents console.error messages emitted by code from reaching the console for given function
* @param {Function} fn Function to run without showing errors
* @return {Object<{errorLogs: string[], warnLogs: string[], result: any}>} array containing
* warnings & errors outputted running the function, and the function result
* @return array containing warnings & errors outputted running the function, and the function result
*/

@@ -51,3 +50,3 @@ function blockLogOutput(fn) {

}
/********************************************* TESTS **********************************************/
/*-------------------------------------------- TESTS ---------------------------------------------*/
describe('inspect', function () {

@@ -54,0 +53,0 @@ it('exists', function () {

{
"name": "mad-logs",
"version": "11.4.0",
"version": "12.0.0",
"description": "Winston-lite-esque Log lib for terminal and browser debugging, with piles of unignorable log tags and marker styles.",

@@ -47,3 +47,3 @@ "main": "lib/index.js",

"dependencies": {
"colors": "^1.1.2",
"@colors/colors": "^1.5.0",
"detect-node": "^2.0.3",

@@ -56,3 +56,2 @@ "env-var-helpers": "^5.2.0",

"@types/chai": "^4.1.4",
"@types/colors": "^1.1.1",
"@types/lodash": "^4.14.109",

@@ -59,0 +58,0 @@ "@types/mocha": "^5.2.2",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet