JustLog.js is a fully open source logger for JavaScript and Node.js projects. It comes without any external dependencies and is easy to use and extend.
npm install justlog.js
JustLog supports CommonJS and ES6 module style imports.
import {JustLog} from 'justlog.js';
/**
* Creates a new logger to console
*/
let logger = new JustLog('My Logger', JustLog.LEVEL_WARNING);
logger.warning('This is a warning!');
let JustLog = require('justlog.js').JustLog;
/**
* Creates a new logger to console
*/
let logger = new JustLog('My Logger', JustLog.LEVEL_WARNING);
logger.warning('This is a warning!');
JustLog can also be included in the browser with the pre-built minified scripts.
<script src="./dist/justlog.main.min.js"></script>
<script>
/**
* Create a logger without color
*/
const logger = new justlog.JustLog('My Loggger', justlog.JustLog.LEVEL_INFO,
new justlog.JustLogConsoleStream({color: false}));
// debug should not output anything
logger.warning('This is a warning!');
</script>
See the examples folder for full examples.
Some of the following commands may require you to install the development dependencies.
The JSDocs can be found here.
To build the documentation yourself run
npm run docs
To run the tests use
npm run test
To build a minfied version for distribution use
npm run dist
To lint the code use
npm run lint
JustLog.js is licensed under the MIT license.