loglevel-plugin-mock
Version:
Template plugin for mocking and testing
1 lines • 983 B
JavaScript
!function(e,t){if("function"==typeof define&&define.amd)define(["module","exports"],t);else if("undefined"!=typeof exports)t(module,exports);else{var o={exports:{}};t(o,o.exports),e.mock=o.exports}}(this,function(e,t){"use strict";function o(){var e=void 0,t=void 0,o=void 0,n=function(){return o},r={method:function(){}};this.apply=function(i,a){if(!i||!i.getLogger)throw new TypeError("Argument is not a root loglevel object");if(e&&n!==i.methodFactory)throw new Error("You can't reassign a plugin after appling another plugin");e=i,a=Object.assign({},r,a),o=a.method,t=t||i.methodFactory,i.methodFactory=n,i.setLevel(i.getLevel())},this.disable=function(){if(!e)throw new Error("You can't disable a not appled plugin");if(n!==e.methodFactory)throw new Error("You can't disable a plugin after appling another plugin");e.methodFactory=t,e.setLevel(e.getLevel()),t=void 0,e=void 0}}Object.defineProperty(t,"__esModule",{value:!0});var mock=new o;t.default=mock,e.exports=t.default});