omg-console

A better console.log for terminal


Keywords
color, colors, console, terminal, 256, ansi, chalk, cli, colour, command-line, formatting, log, logging, rgb, shell, str, string, style, styles, text, tty, xterm
License
MIT
Install
npm install omg-console@1.2.2

Documentation

omg-console


使用

npm install omg-console -save
import Console from 'omg-console'
const console = new Console('my namespace')
console.log('hello world')

Options

new Console('my namespace')
new Console({name: 'xxx', verbose: true})

单例模式

import { console } from 'omg-console'
console.log('xxx') // singleton

import { rawConsole } from 'omg-console'
rawConsole // original global.console

全局调试

# 全局环境变量
export OMG_CONSOLE_VERBOSE=true

特性

  • 全功能的 console 替代方案,支持所有原生 console 方法
  • 常用方法颜色高亮
  • 错误会走到 stderr 流
  • 支持回溯到源码对应行
  • 支持 sourcemap