Skip to content

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

Notifications You must be signed in to change notification settings

Smoke3785/console.mog

Repository files navigation

console.mog - looksmax your console

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.

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.

  • 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

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.
  • 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.

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published