New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

readable-json-log

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

readable-json-log

Utility formats logs for browser console in more readable way (highlights changes and adds colors to JSON representation)

latest
Source
npmnpm
Version
0.4.0
Version published
Maintainers
1
Created
Source

ReadableLogs

Utility formats logs for browser console in more readable way (highlight changes, colorify JSON syntax).

Use case: utility allows to highlight data in JSON format in console logs for better readability. The difference with default presentation of objects in console - utility displays whole content of object instead of collapsed style. Another use case is for scenario when application has stateful client-server API and you need to track differences in state between messages.

Useful links:

  • https://developer.mozilla.org/en-US/docs/Web/API/console#outputting_text_to_the_console

Browsers support:

  • Chrome
  • Safari
  • Firefox

Installation

npm install readable-json-log

Usage

    import { parseMessage } from "./PrettyLogs";
    import { formatForLoggingInBrowser } from "./formattingUtils";

    const message = {
        a: 1,
        b: "2",
        c: ["3"]
    };
    const parsedMessage = parseMessage(message, { multiline: true });
    console.info(...formatForLoggingInBrowser("Formatted message: ", parsedMessage));

or

    import { parseMessage } from "./PrettyLogs";
    import { formatForLoggingInBrowser } from "./formattingUtils";

    const prevMessage = {
        a: 0,
        b: "3",
        c: []
    };
    const message = {
        a: 1,
        b: "2",
        c: ["3"]
    };
    // if prevMessage is provided it should be able to apply option "showDiffWithObject"
    const parsedMessage = parseMessage(message, { showDiffWithObject: prevMessage });
    console.info(...formatForLoggingInBrowser("Formatted message: ", parsedMessage));

Demo page: https://imevs.github.io/ReadableLogs/

Demo

FAQs

Package last updated on 03 Oct 2022

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