https://github.com/dnbard/iconic-logger
Customized console.log output with icons
https://github.com/dnbard/iconic-logger
Last synced: 9 months ago
JSON representation
Customized console.log output with icons
- Host: GitHub
- URL: https://github.com/dnbard/iconic-logger
- Owner: dnbard
- Created: 2015-07-15T14:27:55.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-07-25T16:49:04.000Z (almost 11 years ago)
- Last Synced: 2025-08-09T08:26:45.299Z (11 months ago)
- Language: JavaScript
- Homepage: http://dnbard.github.io/iconic-logger/
- Size: 219 KB
- Stars: 13
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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)
```js
var iconicLogger = require('iconic-logger');
var myLogger = iconicLogger.log('chrome');
myLogger('Chrome is awesome!');
```
* Regular browser
```
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:
```js
var iconicLogger = require('iconic-logger');
var myLogger = iconicLogger.log('chrome', 'My log:');
myLogger('Chrome is awesome!');
myLogger('I really like it!');
```

## Iconic Logger instance API
* .log(icon[, prefix])
Create a logger that is similar to `console.log` with icon and optional prefix
* .info(icon[, prefix])
Create a logger that is similar to `console.info` with icon and optional prefix
* .error(icon[, prefix])
Create a logger that is similar to `console.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