Skip to content

ddo/dlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dlog

a Simple & Beautiful Logging for Browser

Features

  • Super Lightweight (<2kb)
  • Colorful.
  • Font size customize.
  • Timestamp.
  • Log levels: trace, debug, info, warn, error.
  • Silent mode. (for production)
  • Limit logs by level.

Installation

Manual

Download dlog.js here

<script src="dlog.min.js"></script>

Bower

bower install dlog

Component

component install ddo/dlog

Init

var log = new dlog();

Levels (in order)

  • trace
  • debug
  • info
  • warn
  • error
  • silent

Usage

init

var log = new dlog({
	name: "App Name",
	size: 20, //font size
	level: "info"
});

.log(level, data)

log.log('info', data);
log.log('debug', data]);

...

.{level}(data)

log.trace(data);
log.warn(data);
log.error(data);

...

.setSize()

  • Default: 14px
  • Set font size
log.setSize(19);

.setName()

  • Default: "DLOG"
  • Set App name, you may have many apps to log.
log.setName("App Name");

.setLevel()

  • Default: "info"
  • Set logging level to limit the showing log.
  • For example, if logging level is "info" then all the "trace" and "debug" level logs will not be showed.
  • Set level to "silent" to stop all log. (good for production)
log.setLevel("silent");

Examples

log.trace

log.debug

log.info

log.warn

log.error

log.silent

Nothing !!!

Table

Table will show if data is a array of objects

Todo

  • Customize level.
  • Color Setting.
  • Log format templates.

License

MIT © Ddo