Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

diy-log

Package Overview
Dependencies
Maintainers
0
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diy-log

Various console log level prefixes with support for color symbols and tags.

  • 2.5.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

diy-log 🌈

version Codecov release node.js languages downloads

Various console log level prefixes with support for color symbols and tags.

自定义控制台各种级别日志输出的前缀,支持颜色符号,标签和时间。

img

Installation

npm install diy-log --save-dev

Usage

// for cjs
const logger = require('diy-log')
const { log, symbols, colors, tag } = logger


// for esm
import logger, {
  log,
  colors,
  symbols,
  tag
} from 'diy-log'
time('time ...')

info('info ...')
done('done ...')
error('error ...')
warn('warn ...')

log(symbols.info, 'info ...')
log(symbols.done, 'done ...')
log(symbols.error, 'error ...')
log(symbols.warn, 'warn ...')


log(colors.dim('dim:text;'))
log(colors.blue('color: blue;'))
log(colors.bgGreen('bgcolor: green;'))
log(colors.bold('bold:text;'))
log(colors.italic('italic:text;'))
log(colors.underline('underline:text;'))


tag('info message')
tag('success message', 'done', 'success')
tag.warn('warning message')
tag.done('done message')
tag.info(colors.blue('info message'))
tag.error('error message')

Methods

type Log = (...args: any[]) => void

type TagType = (message: string, label?: string) => void

interface Tag {
  (message: string, tag: 'info' | 'error' | 'done' | 'warn' = 'info', label?: string): void
  info: TagType
  error: TagType
  done: TagType
  warn: TagType
}
  • log: Log;
  • time: Log;
  • info: Log;
  • error: Log;
  • done: Log;
  • warn: Log;
  • tag: Tag;
  • tag.info: TagType;
  • tag.error: TagType;
  • tag.done: TagType;
  • tag.warn: TagType;

Thanks

log-symbols , picocolors , time-stamp

Keywords

FAQs

Package last updated on 28 Nov 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc