All Projects → r37r0m0d3l → consono

r37r0m0d3l / consono

Licence: MIT license
The most correct, informative, appealing and configurable variable inspector for JavaScript

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to consono

debug.js
Debugger of JavaScript, by JavaScript, for JavaScript
Stars: ✭ 19 (+11.76%)
Mutual labels:  console, log, debug
Go Logger
一个简单而强大的 golang 日志工具包,支持同步和异步输出到 命令行,文件, api 接口,文件支持按文件大小,文件行数,日期切分;A simple and powerful golang logging toolkit that supports synchronous and asynchronous output to the console, file, API interfaces, file support by file size, file line number, date sharding.
Stars: ✭ 152 (+794.12%)
Mutual labels:  console, log
Quicklogger
Library for logging on files, console, memory, email, rest, eventlog, syslog, slack, telegram, redis, logstash, elasticsearch, influxdb, graylog, Sentry, Twilio, ide debug messages and throw events for Delphi/Firemonkey/freepascal/.NET (Windows/Linux/OSX/IOS/Android).
Stars: ✭ 137 (+705.88%)
Mutual labels:  console, log
Lumberjackconsole
On-device CocoaLumberjack console with support for search, adjust levels, copying and more.
Stars: ✭ 205 (+1105.88%)
Mutual labels:  console, log
Simple Console
Add an elegant command-line interface to any page
Stars: ✭ 107 (+529.41%)
Mutual labels:  console, log
Rainbow
Delightful console output for Swift developers.
Stars: ✭ 1,606 (+9347.06%)
Mutual labels:  console, log
Cypress Terminal Report
Better terminal and file output for cypress test logs.
Stars: ✭ 200 (+1076.47%)
Mutual labels:  console, print
Logging Helpers
Basic template helpers for printing messages out to the console. Useful for debugging context in templates. Should work with any template engine.
Stars: ✭ 5 (-70.59%)
Mutual labels:  console, log
axios-curlirize
axios plugin converting requests to cURL commands, saving and logging them.
Stars: ✭ 152 (+794.12%)
Mutual labels:  log, debug
GoogleCloudLogging
Swift (Darwin) library for logging application events in Google Cloud.
Stars: ✭ 24 (+41.18%)
Mutual labels:  log, debug
log-utils
Basic logging utils: colors, symbols and timestamp.
Stars: ✭ 24 (+41.18%)
Mutual labels:  console, log
Signale
Highly configurable logging utility
Stars: ✭ 8,575 (+50341.18%)
Mutual labels:  console, log
Debuguisystem
Create a runtime menu system with buttons and windows for debugging in one line of code.
Stars: ✭ 48 (+182.35%)
Mutual labels:  console, debug
Console Badge
🎨 Create simple badges in the browser console
Stars: ✭ 130 (+664.71%)
Mutual labels:  console, log
Loglevelnext
A modern logging library for Node.js that provides log level mapping to the console
Stars: ✭ 33 (+94.12%)
Mutual labels:  console, log
Tinyconsole
📱💬🚦 TinyConsole is a micro-console that can help you log and display information inside an iOS application, where having a connection to a development computer is not possible.
Stars: ✭ 1,929 (+11247.06%)
Mutual labels:  console, log
webpack-log
A logger for the Webpack ecosystem
Stars: ✭ 18 (+5.88%)
Mutual labels:  console, log
Console
OS X console application.
Stars: ✭ 298 (+1652.94%)
Mutual labels:  console, log
Electron Log
Just a simple logging module for your Electron application
Stars: ✭ 765 (+4400%)
Mutual labels:  console, log
alog
Update: use loguru instead. Simple straight logging your Python code
Stars: ✭ 38 (+123.53%)
Mutual labels:  debug, print

Consono

🕵️ Consono 🕵️‍♀️

The most correct, informative, appealing, and configurable variable inspector for JavaScript.

📝 Consono Documentation

npm downloads stars types build lgtm


🔋 Motivation

Motivation and differences from other libraries.

  • ☀️ Light and 🌑 dark themes for terminal output.
  • 🎚️ Configurable coloring of variables.
  • Can print to terminal or 🌈 return formatted and colored string for later use.
  • 🔀 Turn on/off output colorization.
  • Configurable indent - tabs 🆚 spaces holy war 👼🏻 ⚔️ 🇻🇦.
  • Availability to set the 🕳️ depth for object inspection.
  • Configurable #️⃣ max items for array, map, object, set.
  • ✂️Limit string length when printing for better readability.
  • Inspect both string 📐 character count and 📏 string length.
  • Inspect 0️ positive zeroes and 0️ negative zeroes.
  • Inspect 🔍 items count for collection-like variables array, map, object, set.
  • Actually 🔬 can inspect arguments, set and map.
  • Can print 📛 function names or mark them as anonymous.
  • Handles 🔄 circular references.
  • Has 📘 TypeScript declaration file.
  • Avoids 🔱😈🔥 dependency hell.
  • Can 🧹 clear terminal before output.
  • Can 💥 exit Node.js process after output.
  • Import as 🆕 ECMAScript module.
  • And so on and so forth ♾️.

🧬 Examples

consono(undefined);
consono(null);

Nil

consono(true);
consono(false);

Boolean

consono(Infinity);
consono(Number.NEGATIVE_INFINITY);
consono(NaN);
consono(1);
consono(1.5);
consono(BigInt(9007199254740991));

Number

consono(new Date());

Date

consono("Hello, world 😀😁😂🤣😃😄😅😆😉😊", { stringMaxLength: 17 });
consono(Symbol("🌈"));

String

consono(/[0-9]+/);
consono(/\w+/giu);

RegExp

consono(function() {});
consono(function helloWorld() {});
consono(() => {});

Function

consono(new Promise(() => {}));
consono(async function helloWorld() {});
consono(async () => {});
consono(function* gen() { yield 1; });

Async

consono([1, 2, 3]);
consono(Int8Array.from([1, 2, 3]));

Array

consono(new ArrayBuffer(8));
consono(new SharedArrayBuffer(16));

Array Buffer

consono(new Set(["a", true, { prop: 1 }]));
consono(new Map([["first", "a"], [true, "b"]]));
consono(new WeakMap());
consono(new WeakSet());

Collection

consono({});

class MyClass {} const myClass = new MyClass(); myClass.deeper = new
MyClass(); consono(myClass);

Object

consono(new Error("Standard error"));
consono(new EvalError("Unable to run this code"));
consono(new RangeError("Must be less than 10 and greater than 0"));
consono(new ReferenceError("This is error from try/catch"));
consono(new SyntaxError("Not a source code"));
consono(new TypeError("Value is not of the expected type"));

Error

(function(a, b) { consono(arguments); })(true, false);

Arguments

consono(global || globalThis, { objectMaxProps: 3 });

Global

📦 Installation

npm -s install consono

⌨️ Include

The default is a function for printing variable.

import { consono } from "consono";

Import multiple items: function, constructor, options object, theme objects.

import {
  Consono,
  consono,
  options,
  THEME_DARK,
  THEME_LIGHT,
} from "consono";

UNPKG CDN.

Note that the web browser version has no theme support, limited color palette, and only support chromium based browsers.

<script src="https://unpkg.com/consono/dist/consono.js"></script>

⚙️ Options

import { Consono } from "consono";
const options = {
  clear: true,
  quotesEnd: `”`,
  quotesStart: `“`,
  stringMaxLength: 54,
};
const theme = "light"; // default is "dark"
const consono = new Consono(options, theme);
consono.log("Cleared before output. Different quotes. And cut to 54!");
// string • "Cleared before output. Different quotes. And cut to 54"
// (length=55, shown=54)
import { Consono } from "consono";
const theme = {
  argument: [253, 151, 31],
  boolean: [174, 129, 255],
  comment: [117, 113, 94],
  keyword: [249, 38, 114],
  name: [230, 219, 116],
  number: [174, 129, 255],
  plain: [255, 255, 255],
  property: [102, 217, 239],
  string: [166, 226, 46],
};
const consono = new Consono(null, theme);
consono.log("Themed");
import { Consono, options } from "consono";
options.colorize = false;
const consono = new Consono(options);
consono.log("Text without colorization");
import { consono } from "consono";
console.debug(
  consono("Outputs a message only at the debug log level.", false)
);

🏷️ Instance

const consono = Consono.factory(options, theme);
consono("This is log function with your own options");

🔖 Log function

import { consono } from "consono";
const map = new Map();
map.add("key", true);
consono(map);

Return string with variable description.

const variableAsString = consono({}, false);

or

const variableAsString = consono({},  { console: false });
const defaultOptions = {
  // Maximum number of elements in array to show
  arrayMaxElements: 99,
  // Assign symbol
  assignSymbol: "→",
  // Clear console before output
  clear: false,
  // Colorize the output
  colorize: true,
  // Output to console
  console: true,
  // Default depth of object
  depth: 20,
  // 'false' - do nothing. 'true' - exit status ok.
  // Number greater than zero - exit status with passed error code.
  exit: false,
  // Call console.log immediately
  immediate: false,
  // Print indentation
  indent: "ˑˑ",
  // Maximum number of entries in map to show
  mapMaxEntries: 99,
  // Maximum number of properties in object to show
  objectMaxProps: 99,
  // Quote start
  quotesEnd: `"`,
  // Quote end
  quotesStart: `"`,
  // Return inspected variable as string
  returns: true,
  // Maximum number of values in set to show
  setMaxValues: 99,
  // Call `process.stdout.write` instead of `console.log`.
  stdout: false,
  // Maximum length of string to show
  stringMaxLength: 360,
};
consono("Some variable", defaultOptions);

🔮 Shortcuts

// Exit code - 15
consonoExit("Some value", null, null, 15);
// No colorization, no description, only printing with `console.dir`
consonoJSON("Some value");
// No colorization, no description, only printing with `process.stdout.write`
consonoOut("Some value");
// No colorization
consonoPlain("Some value");
// Return only, no `console.log`
consonoReturn("Some value");

👀 Discover more

My other projects

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].