npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2024 – Pkg Stats / Ryan Hefner

console.mog

v0.0.59

Published

Looksmax your console 🀫🧏

Downloads

2,715

Readme

A powerful tool for building attractive logs that closely represent your data.

Iliad Badge NPM Version NPM Downloads

Welcome to console.mog, a transformative tool designed to take our beloved console from mundane to magnificent. This library gives you the ability to create gorgeous terminal readouts without adopting the technical overhead that comes with a dedicated CLI-builder.

See Features | Get Started | Should I Use?

As simple as this...

import mog from 'console.mog'; // Also supports CJS

mog(console); // And you're done!

and now you have this...

Pretty GIF

[!WARNING]
This project is in alpha (πŸ’ͺ🐺). It is not ready for production use and will not be for several more weeks/months.

Features πŸ’…πŸ»

πŸš€ Transformative Logging Experience

  • Looksmax your logs: Beautify your terminal output without breaking a sweat.
  • Every native logging feature remains, but each has been supercharged with added functionality and a brand new look.
  • Minimal setup: A single function call is all it takes to supercharge your console, but the powerful API enables deep customization!
  • Add colors, links, and rainbow text to your logs with ease.

πŸ“Š Simple Declarative API

  • Works seamlessly with console.log, console.group, and other familiar methods.
  • Infinite method chaining to build complex reports quickly.
  • Fully typed, for your convenience.
  • Polyfills / fallbacks available for any environment* you find wanting for style.

🌟 Represent any data or process

  • Implicit and explicit syntax highlighting for structured data.
  • Promise visualization: See how promises resolve or reject in real time, animations and all.
  • Advanced tree and table rendering for nested or tabular data structures.

🎯 Style + Substance

  • Built-in integrations to send your logs whereever they need to go, and a powerful API to build your own. Built in:
    • Filesystem
    • Discord Webhooks
    • Generic Remote Server
    • Generic Webhooks

[!IMPORTANT]
Full documentation available soon.

Pre-Launch Requirements

Stuff I gotta do before shilling on reddit. πŸ€¨πŸ˜—

This project is in the first phase of development. Here's a list of milestones to hit before releae:

Critical for alpha 🐺

  • Graceful failure. Currently crash reports are printed overtop of the console... can we wrap them to handle graceful failures?

  • Make sure console.mog has parity with console.log - may need to just proxy stuff like chart to underlying functionality.

    • console.time and console.profile methods need hooks for the Timestamp system.
    • dir, dirxml - https://developer.mozilla.org/en-US/docs/Web/API/console/dir_static
    • console.assert https://developer.mozilla.org/en-US/docs/Web/API/console#using_string_substitutions
    • console.count
  • Make native fallbacks for when this is run in the browser.

  • Make readme

  • NOTE: Many calculations should be done on a per-line basis, not a per-log basis - aggressive caching will be required.

  • It appears that something related to the line splitting doesn't re-calculate until a full re-render...

  • There needs to be another check for if a smart-render will take the rendered content outside the bounds of the screen. If so, it must dumb-render once to re-align content to the bottom.

Critical for literally anything useful

  • Performance improvements. Obviously nowhere near as fast as native implementation, but there's tremendous room for performance improvements.
    • Currently dumb render starts from the top and goes down. That's silliness.
    • VSCode only renders 1,100-ish logs anyhow. Rendering only needs to be fancy for the last few thousand logs.
      • When the program exits / crashes, a static version of logs should be spat into the console. Nothing fancy.
  • Determine interoperability with other logging libraries.
  • Determine interoperability with CLI tools that handle other stuff
  • Make static mode for CI
  • There should be a check to see if we're simply adding characters to the end of the DOM. If appending, just print the line like normal instead of dumb rendering.

Known bugs

  • logs created by piping a stream to console.mog() aren't included when the console re-renders on resize. Subsequent messages will restore the output, though...

Future features

  • console.promise(promise) syntax, console.promiseAll(promises) syntax.

  • Render boxes, links, rainbow text.

    • terminal.link() - https://www.npmjs.com/package/terminal-link
  • Create Toolbox interface that contains chalk, link, etc. and can be passed to every log.

  • Create Context interface that contains LogData, selected DOM information, etc.

  • Alignment api. Left, center, right align. Unsure how I'm going to do this. console.center(console.log()) possible?

  • SideEffect class + sideEffects config option, that will do other stuff with your logs when they occur. Builtins:

    • FileSystem will dump your logs in a file, nuff said.
    • Discord will turn your logs into a discord webhook.
    • SimpleRemote simple api for duplicating your logs as HTTP requests
    • SimpleWebhook is this redundant with above?
  • console.tree() for directly rendering nested structures. May need a callback fn to run on every node to get children and label.

  • Syntax highlighting in returned info - https://www.npmjs.com/package/cli-highlight

  • Can be explicit console.highlight("json", fs.readFileSync('./package.json'))

    • Or implicit console.log({keyOne: "string", keyTwo: 5, keyThree: [1,2,3]})
  • console.directory()?? - https://github.com/athityakumar/colorls#readme

  • console.styledTable() more control over neat looking console.

  • console.hr should accept a string that can be centered.

  • console.format or toolkit or whatever should have a colorRange function, that takes values and maps them to colors, like excel. This would be cool for number readouts.

Code cleanup

  • LogData should be generic - I need to simplify the Log types and how they actually resolve their data.