Iconic Logger
Customizable logger with icons support for browser
Install
npm install iconic-logger --save
Browser support
Only Chrome are supporting the image output to console.
Every other browser just write your log as usual console.log
.
How to use
- CommonJS(browserify)
var iconicLogger = ;var myLogger = iconicLogger; ;
- Regular browser
<script src="iconic-logger.js"></script>
var myLogger = window.iconicLogger('chrome');
myLogger('Chrome is awesome!');
Will put next to the console log:
- Prefix support
You can specify the prefix that will appear at the beginning of every message:
var iconicLogger = ;var myLogger = iconicLogger; ;;
Iconic Logger instance API
-
.log(icon[, prefix])
Create a logger that is similar toconsole.log
with icon and optional prefix -
.info(icon[, prefix])
Create a logger that is similar toconsole.info
with icon and optional prefix -
.error(icon[, prefix])
Create a logger that is similar toconsole.error
with icon and optional prefix -
.getIconNames()
Returns a list of registered icon names -
.getIcons()
Returns a list of registered icons
Using the custom set of icons
- Install all package dependencies
npm install
- Put the icons to
/icons
folder Default icons size should be 16px.
If icons have other size then it should be encoded in its name using next mask: %ICON_NAME%-%ICON_SIZE%.%ICON_EXTENSION%. In example:
apple.png
apple-32.png
Next file types are supported: png, gif, jpg
.
- Compile icons
gulp build:js
- Take the custom build of Iconic Logger from
/dist
folder