Light-weight front-end logger, compatible with CJS, AMD and script tag loading.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test
.gitignore
.jshintignore
.jshintrc
LICENSE
README.md
bower.json
flog.js
package.json
testacular.conf.js

README.md

flog

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

install

npm install flog or download flog.js

loading

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
flog

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:

flog.setLevel('info');

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');
myFlog.info('Hello'); // doesn't output anything
myFlog.warn('Hello'); // doesn't output anything
myFlog.error('Hello'); // 'Hello'

logging methods

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