Log mixin with levels of verbosity
importcomposefrom'uc-compose'import{log,LOG_LEVEL}from'uc-log'constMyClass=function(){}MyClass.prototype=compose(log,{logLevel: LOG_LEVEL.DEBUG,logName: 'My Class',method: function(){this.log(LOG_LEVEL.INFO,'Hello')}})Logs all args into console if level is smaller than logLevel property of the class.
- logLevel - number, defines the maximum log level to be printed out
- logName - string, if defined will be prepended to every log line
constLOG_LEVEL={NONE: 0,ALERT: 1,CRITICAL: 2,ERROR: 3,WARNING: 4,NOTICE: 5,INFO: 6,DEBUG: 7,ALL: 255}License MIT
© velocityzen