https://github.com/fed135/logger
Console logging for modern browsers
https://github.com/fed135/logger
Last synced: 4 months ago
JSON representation
Console logging for modern browsers
- Host: GitHub
- URL: https://github.com/fed135/logger
- Owner: fed135
- License: gpl-2.0
- Created: 2016-01-13T20:17:06.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-19T00:35:59.000Z (almost 10 years ago)
- Last Synced: 2025-08-13T08:30:12.825Z (5 months ago)
- Language: JavaScript
- Size: 29.3 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Logger
[](https://travis-ci.org/fed135/Logger)
[](https://www.npmjs.com/package/console-logger.js)
[](#)
## What is Logger?
Logger is a logging utility for your browser.
Ever encountered one or more of these issues:
- Need defined (and perhaps customizable) log levels
- Need ability to mute certain levels logging on certain environements
- Need to pipe your error logs to a tracking service
- Need more color and liveness in your console
- Need prettier error statements
Logger aims to solve ALL of these issues and more!
It's a library that is build **next** to the browser's default console and does **not** override it.
It can be loaded as an AMD module or used globaly.

And it's super light: 1.74Kb (minified)!
## Compatibility
Browser | Compatibility
---------------------| -----------------------
*Chrome* | Yes
*Firefox* | Yes
*IE / Edge* | Yes
*Opera* | Yes
*Safari* | Yes
## Releases
**Static**
[Latest release](https://github.com/fed135/Logger/releases/latest)
[All releases](https://github.com/fed135/Logger/releases)
**NPM**
$ npm install console-logger.js
**Bower**
$ bower install logger.js
## Usage
Simply import the minified/unminified script from dist, then start configuring:
**Loading the module**
// If requireJS or another AMD-compatible loader is detected:
require('logger', function(logger) {
logger.log('Hello there!');
});
// Or else, it should be available through the global namespace:
window.logger.log('Bloody hell!');
**Creating log levels**
// I want an error level for when stuff explodes
logger.add('critical', {
style: 'color:purple;font-weight:bold;'
});
**Selecting levels**
// I want to mute everythin in Production
logger.select('*').mute(); // Mutes all the channels
**Piping**
// I want to send errors and criticals to my tracking service
logger.select(['error', 'critical']).pipe(myTrackingService);
**Changing the style**
// I want error logs to be sassier
logger.select('error').style('color:pink;text-shadow:1px 1px 0px rgba(0,0,0,0.4)');
// I can use CSS styling!
**Actually printing stuff**
logger.log('This is a log!');
logger.warn('This is a warning!');
logger.error('This is an error!');
// These 3 are created by default
## Compiling
Running `gulp` will compile new minified and minifed versions.
## Testing
Running `gulp test` will launch the test sequence.
## Roadmap
[Milestones](https://github.com/fed135/Logger/milestones)