Press "Enter" to skip to content

A Simple Browser Logger Tool in the Web Console | pretty-browser-log

PrettyLog is a simple browser logger(recording) tool. It’s wrapped from console.log to make it easier. Pretty Log is a JavaScript library to replace the console.log () function that applies custom styles for the log tags (labels) and messages displayed in the web console.

browser console chrome, console log not working in chrome, chrome console log to file, firefox web console, chrome developer tools, firefox console commands

Features:

  • Maintains a registered code line number.
  • Label styled
  • Text message
  • Turn on and off
  • I collect new patterns

How to make use of it:

1. Install the PrettyLog with NPM.

# NPM
$ npm i pretty-browser-log --save

2. Import the PrettyLog.

import {prettyLog} from './src/prettylog.js';
export {prettyLog};
import {prettyLog as log} from './index.js'

3. Create your individual themes by making use of customized CSS styles to logs.

log.addManyLogStyles([
  {name:'title',badge:'Title:',badgeStyle:'',messageStyle:'color:black;font-size:1rem;font-weight:bold;'},
  {name:'danger',badge:'Danger:',badgeStyle:'background-color:red;',messageStyle:'color:red'},
  {name:'todo',badge:'ToDo:',badgeStyle:'background-color:red',messageStyle:'background-color:yellow;color:red;'},
  {name:'action',badge:'Action:',badgeStyle:'background-color:#6b5b95',messageStyle:'color:#6b5b95'},
  {name:'noLabel',badge:'',badgeStyle:'border: 0',messageStyle:'color:#4CD964; border: 1px solid;border-radius:0.4rem;padding:2px 6px'},
  {name:'dot',badge:'  ',badgeStyle:'background-color:orange ;border-radius:50%',messageStyle:''},
  {name:'success',badge:'Success:',badgeStyle:'background-color:#4CD964',messageStyle:'color:#4CD964;'},
  // ...
])

4. Display logs with totally different styles within the browser console.

// default
log.msg('Log Messages Here');

// title theme
log.title('Log Messages Here');

// danger theme
log.danger('Log Messages Here');

// success theme
log.success('Log Messages Here');

// action theme
log.action('Log Messages Here');

// todo theme
log.todo('Log Messages Here');

// with no label
log.noLabel('Log Messages Here');

// dot themes
log.dot('Log Messages Here');

Display Logs In Web Console, console log in javascript, chrome browser console logs, Pretty Log Plugin/Github, firefox console log to file, what is a browser console


See Demo And Download

Official Website(ianes1978): Click Here

This superior jQuery/javascript plugin is developed by ianes1978. For extra advanced usage, please go to the official website.

Be First to Comment

    Leave a Reply

    Your email address will not be published.