Skip to content

pretty log messages for browser. 一个可以在浏览器控制台打印出漂亮信息的工具。

License

Notifications You must be signed in to change notification settings

kevinzhao2233/b-pretty-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

b-pretty-log

A browser console.log() tool, which can make the printed message look better.

How to install:

Using npm:

npm install b-pretty-log

Using yarn:

yarn add b-pretty-log

Using jsDelivr CDN:

<script src="https://cdn.jsdelivr.net/npm/b-pretty-log/dist/index.js"></script>

Example

Import libraries in entry file:

import log from 'b-pretty-log'

Print a message:

log('info', 'Component is mounted')

e-01

More ways to use it:

const err = { code: 404, msg: 'Not Found' }
log('Success', 'Request successful!', 'success')
log('Warn', 'This is not supported!', 'warning')
log('Error', err, 'danger')

log.error('-->>', err)

// pretty log style
const res = { code: 200, msg: 'success', data: true }
log.pretty('Info', 'Request Info', res)

log.pretty('Success', '-->>', 'Success Info', 'success')

e-02

API

log(text: any, content: any, color?: ColorType, back?: boolean)

  • **text: **Content in a wireframe or box
  • content: The content behind a wireframe or square
  • color: <ColorType> or hex color value, <ColoType> has 'success' | 'warning' | 'danger' | 'info' | 'primary'(default)
  • back: Is display background, the text will be white

Alias of the method

  • log.success(text, content)
  • log.warn(text, content)
  • log.error(text, content)
  • log.info(text, content)

log.pretty(title: string, text: string, content: any, color?: ColorType)

  • title: Text on the background
  • text: Text on the border
  • content: details
  • color: <ColorType> or hex color value, <ColoType> has 'success' | 'warning' | 'danger' | 'info' | 'primary'(default)

About

pretty log messages for browser. 一个可以在浏览器控制台打印出漂亮信息的工具。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published