light-weight configurable front-end logger. CJS, AMD, script compatible


flog is a light-weight configurable front-end logger that is compatible with CJS, AMD and script loading. It can be used with node.js as well, but there are probably more complete solutions such as Winston; Tested in IE8, IE9, IE10, Chrome, Firefox, Safari, Opera

npm install flog or download flog.js

flog can be loaded as:

  • CJS module, which is useful if you use browserify or webmake or are using flog with node.js.
  • AMD module with all AMD compatible loaders
  • simple script tag adding flog to the global namespace
// CJS 
flog = require('flog');
// AMD 
require(['flog'], function (flog) {
// script 

By default, flog is set to be silent and doesn't output anything. To enable logging, you need to set the level:


Possible values include:

  • debug
  • info
  • warn
  • error
  • quiet
  • all - alias for debug
  • silent - alias for quiet

you can use the default flog object but you can also get instances set to different logging levels:

myFlog = flog.create();
myFlog.info('Hello'); // doesn't output anything 
myFlog.warn('Hello'); // doesn't output anything 
myFlog.error('Hello'); // 'Hello' 
  • flog.log()
  • flog.info()
  • flog.warn()
  • flog.error()