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
// CJSflog = ; // AMD // scriptflog
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;
Possible values include:
debug
info
warn
error
quiet
all
- alias fordebug
silent
- alias forquiet
creating an instance
you can use the default flog object but you can also get instances set to different logging levels:
myFlog = flog;myFlog;myFlog; // doesn't output anythingmyFlog; // doesn't output anythingmyFlog; // 'Hello'
logging methods
flog.log()
flog.info()
flog.warn()
flog.error()