node package manager
Love JavaScript? Your insights can make it even better. Take the 2017 JavaScript Ecosystem Survey »



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 

setting the log level

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

creating an instance

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

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

logging methods

  • flog.log()
  • flog.warn()
  • flog.error()