Comparing version 1.2.0 to 1.3.0
# clogy changelog | ||
## 1.3.0 | ||
- Added Object.freeze and did minor refactoring | ||
- Created barrel file for importing and exporting | ||
- Upgraded various packages and removed obsolete one's | ||
- Added lodash-fp | ||
- Major fixes in flowjs; removed gulp-flowtype | ||
- Added new "extensions" directory for extending clogy's functionality | ||
## 1.2.0 | ||
@@ -4,0 +13,0 @@ |
@@ -37,4 +37,6 @@ # Contributing | ||
``` | ||
A dist folder will be created (with clogy.js library) | ||
* An in memory folder (equivalent to ```dist``` folder containing clogy.js library and index.html file) will be created. | ||
* Server will start on port ```3000``` along with webpack-hot-middleware watch. Open ```http://localhost:3000``` from your browser and play with clogy. | ||
When you are done with your changes: | ||
@@ -66,3 +68,3 @@ ```bash | ||
Run in Development mode (with watch): | ||
Run in Development mode (with webpack-hot-middleware watch): | ||
```bash | ||
@@ -69,0 +71,0 @@ $ gulp |
247
lib/clogy.js
@@ -1,2 +0,2 @@ | ||
/*! clogy - v1.2.0 * https://github.com/pgmanutd/clogy * (c) 2016 pgmanutd * licensed MIT */ | ||
/*! clogy - v1.3.0 * https://github.com/pgmanutd/clogy * (c) 2017 pgmanutd * licensed MIT */ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
@@ -58,3 +58,3 @@ if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = __webpack_require__(5); | ||
module.exports = __webpack_require__(7); | ||
@@ -64,27 +64,27 @@ | ||
/* 1 */ | ||
/***/ function(module, exports) { | ||
/***/ function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
'use strict'; | ||
exports.__esModule = true; | ||
exports.default = { | ||
get types() { | ||
return { | ||
log: 1, | ||
trace: 2, | ||
debug: 3, | ||
info: 4, | ||
warn: 5, | ||
error: 6, | ||
none: 7 | ||
}; | ||
}, | ||
get range() { | ||
return { | ||
min: this.types.log, | ||
max: this.types.none | ||
}; | ||
} | ||
}; | ||
exports.LOGGING_METHODS = exports.LOGGING_LEVELS = exports.LOGGING_DEFAULT_OPTIONS = undefined; | ||
var _loggingDefaultOptions = __webpack_require__(4); | ||
var _loggingDefaultOptions2 = _interopRequireDefault(_loggingDefaultOptions); | ||
var _loggingLevels = __webpack_require__(5); | ||
var _loggingLevels2 = _interopRequireDefault(_loggingLevels); | ||
var _loggingMethods = __webpack_require__(6); | ||
var _loggingMethods2 = _interopRequireDefault(_loggingMethods); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.LOGGING_DEFAULT_OPTIONS = _loggingDefaultOptions2.default; | ||
exports.LOGGING_LEVELS = _loggingLevels2.default; | ||
exports.LOGGING_METHODS = _loggingMethods2.default; | ||
/***/ }, | ||
@@ -98,8 +98,4 @@ /* 2 */ | ||
var _loggingLevels = __webpack_require__(1); | ||
var _constants = __webpack_require__(1); | ||
var _loggingLevels2 = _interopRequireDefault(_loggingLevels); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
// I prefer default export rather than named export | ||
@@ -118,3 +114,3 @@ exports.default = { | ||
* Check if console is available or not | ||
* @return {Boolean} Returns true or false | ||
* @returns {Boolean} Returns true or false | ||
*/ | ||
@@ -132,6 +128,6 @@ | ||
* @param {Number} logLevel: Current log level eg. 1, 2, 3, 4 | ||
* @return {Boolean} Returns true or false | ||
* @returns {Boolean} Returns true or false | ||
*/ | ||
function isLogLevelValid(logLevel) { | ||
return !!(logLevel && logLevel >= _loggingLevels2.default.range.min && logLevel <= _loggingLevels2.default.range.max); | ||
return !!(logLevel && logLevel >= _constants.LOGGING_LEVELS.range.min && logLevel <= _constants.LOGGING_LEVELS.range.max); | ||
} | ||
@@ -142,6 +138,6 @@ | ||
* @param {Number} logLevel: Current log level eg. 1, 2, 3, 4 | ||
* @return {Boolean} Returns true or false | ||
* @returns {Boolean} Returns true or false | ||
*/ | ||
function isNoneLogLevel(logLevel) { | ||
return logLevel === _loggingLevels2.default.types.none; | ||
return logLevel === _constants.LOGGING_LEVELS.types.none; | ||
} | ||
@@ -154,6 +150,6 @@ | ||
* @param {String} loggingType : logging method eg. log, info, error, warn | ||
* @return {Boolean} Returns true or false | ||
* @returns {Boolean} Returns true or false | ||
*/ | ||
function isLoggingAllowed(logLevel, loggingType) { | ||
return _loggingLevels2.default.types[loggingType] >= logLevel; | ||
return _constants.LOGGING_LEVELS.types[loggingType] >= logLevel; | ||
} | ||
@@ -163,3 +159,3 @@ | ||
* Get current date and time | ||
* @return {String} Returns date and time in string format | ||
* @returns {String} Returns date and time in string format | ||
*/ | ||
@@ -170,6 +166,6 @@ function getDateTime() { | ||
// 0 means first matched string, which will be true always unless someone | ||
// overrides the result | ||
var time = d.toTimeString().match(/^([0-9]{2}:[0-9]{2}:[0-9]{2})/)[0]; | ||
var customTimeFormat = d.toTimeString().match(/^([0-9]{2}:[0-9]{2}:[0-9]{2})/); | ||
var time = customTimeFormat && customTimeFormat.length ? customTimeFormat[0] : ''; | ||
// NOTE: hey..!! see, 3 is not a magic number, if you think it is, then | ||
@@ -184,2 +180,29 @@ // it's just milliseconds in 3 digits (000-999) | ||
/* 3 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
exports.__esModule = true; | ||
exports.singleton = exports.logging = exports.common = undefined; | ||
var _common = __webpack_require__(2); | ||
var _common2 = _interopRequireDefault(_common); | ||
var _logging = __webpack_require__(10); | ||
var _logging2 = _interopRequireDefault(_logging); | ||
var _singleton = __webpack_require__(11); | ||
var _singleton2 = _interopRequireDefault(_singleton); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.common = _common2.default; | ||
exports.logging = _logging2.default; | ||
exports.singleton = _singleton2.default; | ||
/***/ }, | ||
/* 4 */ | ||
/***/ function(module, exports) { | ||
@@ -190,11 +213,38 @@ | ||
exports.__esModule = true; | ||
exports.default = { | ||
exports.default = Object.freeze({ | ||
showDateTime: false, | ||
prefix: '' | ||
}; | ||
}); | ||
/***/ }, | ||
/* 4 */ | ||
/* 5 */ | ||
/***/ function(module, exports) { | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = Object.freeze({ | ||
get types() { | ||
return { | ||
log: 1, | ||
trace: 2, | ||
debug: 3, | ||
info: 4, | ||
warn: 5, | ||
error: 6, | ||
none: 7 | ||
}; | ||
}, | ||
get range() { | ||
return { | ||
min: this.types.log, | ||
max: this.types.none | ||
}; | ||
} | ||
}); | ||
/***/ }, | ||
/* 6 */ | ||
/***/ function(module, exports) { | ||
'use strict'; | ||
@@ -206,3 +256,3 @@ | ||
/***/ }, | ||
/* 5 */ | ||
/* 7 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -214,3 +264,3 @@ | ||
var _Clogy = __webpack_require__(6); | ||
var _Clogy = __webpack_require__(8); | ||
@@ -237,3 +287,3 @@ var _Clogy2 = _interopRequireDefault(_Clogy); | ||
/***/ }, | ||
/* 6 */ | ||
/* 8 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -245,8 +295,6 @@ | ||
var _singleton = __webpack_require__(9); | ||
var _utilities = __webpack_require__(3); | ||
var _singleton2 = _interopRequireDefault(_singleton); | ||
var _Logger2 = __webpack_require__(9); | ||
var _Logger2 = __webpack_require__(7); | ||
var _Logger3 = _interopRequireDefault(_Logger2); | ||
@@ -277,3 +325,3 @@ | ||
* It works similar to jQuery's no-conflict mode | ||
* @return {clogy} Returns current instance i.e. clogy | ||
* @returns {clogy} Returns current instance i.e. clogy | ||
*/ | ||
@@ -302,3 +350,3 @@ Clogy.prototype.noConflict = function noConflict() { | ||
* functionality | ||
* @return {void | undefined} Returns nothing | ||
* @returns {void | undefined} Returns nothing | ||
*/ | ||
@@ -314,3 +362,3 @@ | ||
decoFunc(_singleton2.default.getInstance(this)); | ||
decoFunc(_utilities.singleton.getInstance(this)); | ||
}; | ||
@@ -327,3 +375,3 @@ | ||
/***/ }, | ||
/* 7 */ | ||
/* 9 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -339,24 +387,6 @@ | ||
var _loggingDefaultOptions = __webpack_require__(3); | ||
var _constants = __webpack_require__(1); | ||
var _loggingDefaultOptions2 = _interopRequireDefault(_loggingDefaultOptions); | ||
var _utilities = __webpack_require__(3); | ||
var _loggingLevels = __webpack_require__(1); | ||
var _loggingLevels2 = _interopRequireDefault(_loggingLevels); | ||
var _loggingMethods = __webpack_require__(4); | ||
var _loggingMethods2 = _interopRequireDefault(_loggingMethods); | ||
var _common = __webpack_require__(2); | ||
var _common2 = _interopRequireDefault(_common); | ||
var _logging = __webpack_require__(8); | ||
var _logging2 = _interopRequireDefault(_logging); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -388,3 +418,3 @@ | ||
* Setting default options like prefix, showDateTime, log level | ||
* @return {void | undefined} Returns nothing | ||
* @returns {void | undefined} Returns nothing | ||
*/ | ||
@@ -396,3 +426,3 @@ | ||
// Set default options | ||
this.setOptions(_loggingDefaultOptions2.default); | ||
this.setOptions(_constants.LOGGING_DEFAULT_OPTIONS); | ||
@@ -405,3 +435,3 @@ // Set default log level | ||
* Used for returning config options | ||
* @return {Number | null} Returns config options | ||
* @returns {ClogyOptionsType | null} Returns config options | ||
*/ | ||
@@ -416,3 +446,4 @@ | ||
* Used for setting options (showDateTime and prefix) | ||
* @return {void | undefined} Returns nothing | ||
* @param {ClogyOptionsType} options: Console options like showDateTime, prefix | ||
* @returns {void | undefined} Returns nothing | ||
*/ | ||
@@ -427,3 +458,3 @@ | ||
* Used for returning current log level; Default is info | ||
* @return {Number | null} Returns current log level | ||
* @returns {Number | null} Returns current log level | ||
*/ | ||
@@ -439,3 +470,3 @@ | ||
* @param {number | string} level: log level (number or string) | ||
* @return {void | undefined} Returns nothing | ||
* @returns {void | undefined} Returns nothing | ||
* @example: | ||
@@ -475,3 +506,3 @@ * clogy.setLevel(1); // log; number type argument | ||
* 'clogy.debug()' won't | ||
* @return {LevelsType} Returns all log levels | ||
* @returns {LevelsType} Returns all log levels | ||
*/ | ||
@@ -482,3 +513,3 @@ | ||
* Get stringifed allowed loggers (Order goes from top to bottom). Use utf-8 encoding for showing tick and cross marks, if not visible. | ||
* @return {String} Returns stringifed allowed loggers | ||
* @returns {String} Returns stringifed allowed loggers | ||
* @example: | ||
@@ -496,7 +527,7 @@ * clogy.stringifyAllowedLoggers(); // When current log level is info | ||
var tickMark = '✔'; | ||
var crossMark = '✖'; | ||
var tickMark = '\u2714'; | ||
var crossMark = '\u2716'; | ||
return _loggingMethods2.default.map(function (loggingType, index) { | ||
return index + 1 + ': ' + loggingType + ' ' + (_common2.default.isLoggingAllowed(_this.getLevel(), loggingType) ? tickMark : crossMark); | ||
return _constants.LOGGING_METHODS.map(function (loggingType, index) { | ||
return index + 1 + ': ' + loggingType + ' ' + (_utilities.common.isLoggingAllowed(_this.getLevel(), loggingType) ? tickMark : crossMark); | ||
}).join('\n'); | ||
@@ -507,3 +538,3 @@ }; | ||
* Enable all levels; equivalent to 'clogy.setLevel(clogy.LEVELS.log)'' | ||
* @return {void | undefined} Returns nothing | ||
* @returns {void | undefined} Returns nothing | ||
*/ | ||
@@ -518,3 +549,3 @@ | ||
* Disable all levels; equivalent to 'clogy.setLevel(clogy.LEVELS.none)'' | ||
* @return {void | undefined} Returns nothing | ||
* @returns {void | undefined} Returns nothing | ||
*/ | ||
@@ -530,3 +561,3 @@ | ||
get: function get() { | ||
return _loggingLevels2.default.types; | ||
return _constants.LOGGING_LEVELS.types; | ||
} | ||
@@ -552,5 +583,5 @@ }]); | ||
* for logging to console | ||
* @return {void | undefined} Returns nothing | ||
* @returns {void | undefined} Returns nothing | ||
*/ | ||
_loggingMethods2.default.forEach(function (method) { | ||
_constants.LOGGING_METHODS.forEach(function (method) { | ||
@@ -570,3 +601,3 @@ // Not using arrow functions because 'this' will be undefined | ||
_logging2.default.logToConsole(logToConsoleParams, args); | ||
_utilities.logging.logToConsole(logToConsoleParams, args); | ||
}; | ||
@@ -581,3 +612,3 @@ }); | ||
/***/ }, | ||
/* 8 */ | ||
/* 10 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
@@ -589,2 +620,4 @@ | ||
var _constants = __webpack_require__(1); | ||
var _common = __webpack_require__(2); | ||
@@ -599,4 +632,2 @@ | ||
// I prefer default export rather than named export | ||
exports.default = { | ||
@@ -610,4 +641,4 @@ logToConsole: logToConsole | ||
* Get console options and push them into an array (for logging) | ||
* @param {Object} options: Console options like showDateTime, prefix | ||
* @return {any[]} Returns an array of console options | ||
* @param {ClogyOptionsType} options: Console options like showDateTime, prefix | ||
* @returns {any[]} Returns an array of console options | ||
*/ | ||
@@ -635,3 +666,3 @@ | ||
* @param {any} args : any value | ||
* @return {void | undefined} Returns nothing | ||
* @returns {void | undefined} Returns nothing | ||
*/ | ||
@@ -670,15 +701,15 @@ function justLogItDude(loggingType, args) { | ||
loggingType: string, | ||
options: Object | ||
options: ClogyOptionsType | ||
} params: Object containing current log level , | ||
* log methods, default options like prefix | ||
* @param {any} args : any value | ||
* @return {void | undefined} Returns nothing | ||
* @returns {void | undefined} Returns nothing | ||
*/ | ||
function logToConsole() { | ||
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, | ||
currentLogLevel = _ref.currentLogLevel, | ||
loggingType = _ref.loggingType, | ||
_ref$options = _ref.options, | ||
options = _ref$options === undefined ? _constants.LOGGING_DEFAULT_OPTIONS : _ref$options; | ||
var currentLogLevel = _ref.currentLogLevel; | ||
var loggingType = _ref.loggingType; | ||
var _ref$options = _ref.options; | ||
var options = _ref$options === undefined ? {} : _ref$options; | ||
var args = arguments[1]; | ||
@@ -703,3 +734,3 @@ | ||
/***/ }, | ||
/* 9 */ | ||
/* 11 */ | ||
/***/ function(module, exports) { | ||
@@ -726,3 +757,3 @@ | ||
* @param {ClogyType} originalInstance: clogy's instance | ||
* @return {ClogyType} Returns a copy of parent | ||
* @returns {ClogyType} Returns a copy of parent | ||
*/ | ||
@@ -740,3 +771,3 @@ | ||
* @param {ClogyType} originalInstance: clogy's instance | ||
* @return {ClogyType} Returns a copy of parent (cached) | ||
* @returns {ClogyType} Returns a copy of parent (cached) | ||
*/ | ||
@@ -750,3 +781,3 @@ function getInstance(originalInstance) { | ||
return instance; | ||
} | ||
} | ||
@@ -753,0 +784,0 @@ /***/ } |
@@ -1,3 +0,3 @@ | ||
/*! clogy - v1.2.0 * https://github.com/pgmanutd/clogy * (c) 2016 pgmanutd * licensed MIT */ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.clogy=t():e.clogy=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(5)},function(e,t){"use strict";t.__esModule=!0,t["default"]={get types(){return{log:1,trace:2,debug:3,info:4,warn:5,error:6,none:7}},get range(){return{min:this.types.log,max:this.types.none}}}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(){return"undefined"!=typeof console}function i(e){return!!(e&&e>=c["default"].range.min&&e<=c["default"].range.max)}function u(e){return e===c["default"].types.none}function l(e,t){return c["default"].types[t]>=e}function s(){var e=new Date,t=e.toDateString(),n=e.toTimeString().match(/^([0-9]{2}:[0-9]{2}:[0-9]{2})/)[0],o=("00"+e.getMilliseconds()).slice(-3);return t+" "+n+"."+o}t.__esModule=!0;var f=n(1),c=o(f);t["default"]={isConsoleDefined:r,isLogLevelValid:i,isNoneLogLevel:u,isLoggingAllowed:l,getDateTime:s}},function(e,t){"use strict";t.__esModule=!0,t["default"]={showDateTime:!1,prefix:""}},function(e,t){"use strict";t.__esModule=!0,t["default"]=["log","trace","debug","info","warn","error"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}t.__esModule=!0;var r=n(6),i=o(r),u=new i["default"];t["default"]=u,e.exports=u},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var l=n(9),s=o(l),f=n(7),c=o(f),a=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return u(t,e),t.prototype.noConflict=function(){return"undefined"!=typeof window&&window.clogy&&delete window.clogy,this},t.prototype.decorator=function(e){if("function"!=typeof e)throw new TypeError("Decorator should be a function");e(s["default"].getInstance(this))},t}(c["default"]);t["default"]=a},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(3),s=o(l),f=n(1),c=o(f),a=n(4),p=o(a),d=n(2),g=o(d),y=n(8),h=o(y),v=function(){function e(){r(this,e),this._options={showDateTime:null,prefix:null},this._level=null,this._setDefaults()}return e.prototype._setDefaults=function(){this.setOptions(s["default"]),this.setLevel(this.LEVELS.info)},e.prototype.getOptions=function(){return this._options},e.prototype.setOptions=function(e){this._options=i({},this.getOptions(),e)},e.prototype.getLevel=function(){return this._level},e.prototype.setLevel=function(e){this._level="string"==typeof e?this.LEVELS[e.toLowerCase()]:e},e.prototype.stringifyAllowedLoggers=function(){var e=this,t="✔",n="✖";return p["default"].map(function(o,r){return r+1+": "+o+" "+(g["default"].isLoggingAllowed(e.getLevel(),o)?t:n)}).join("\n")},e.prototype.enableAllLevels=function(){this.setLevel(this.LEVELS.log)},e.prototype.disableAllLevels=function(){this.setLevel(this.LEVELS.none)},u(e,[{key:"LEVELS",get:function(){return c["default"].types}}]),e}(),L=v.prototype;p["default"].forEach(function(e){L[e]=function(){for(var t={currentLogLevel:this.getLevel(),loggingType:e,options:this.getOptions()},n=arguments.length,o=Array(n),r=0;r<n;r++)o[r]=arguments[r];h["default"].logToConsole(t,o)}}),t["default"]=v},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e){var t=[];return e.showDateTime&&t.push(s["default"].getDateTime()+": "),e.prefix&&t.push(e.prefix),t}function i(e,t){var n=console[e]||console[f];n&&Function.prototype.bind.call(n,console).apply(console,t)}function u(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.currentLogLevel,n=e.loggingType,o=e.options,u=void 0===o?{}:o,l=arguments[1];if(s["default"].isConsoleDefined()){if(!s["default"].isLogLevelValid(t))throw new RangeError("Invalid LogLevel set, Please set a valid LogLevel");!s["default"].isNoneLogLevel(t)&&s["default"].isLoggingAllowed(t,n)&&i(n,[].concat(r(u),l))}}t.__esModule=!0;var l=n(2),s=o(l),f="log";t["default"]={logToConsole:u}},function(e,t){"use strict";function n(e){var t=Object.getPrototypeOf;return t(t(e))}function o(e){return r||(r=n(e)),r}t.__esModule=!0;var r=void 0;t["default"]={getInstance:o}}])}); | ||
/*! clogy - v1.3.0 * https://github.com/pgmanutd/clogy * (c) 2017 pgmanutd * licensed MIT */ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.clogy=t():e.clogy=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(7)},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.LOGGING_METHODS=t.LOGGING_LEVELS=t.LOGGING_DEFAULT_OPTIONS=void 0;var r=n(4),i=o(r),u=n(5),l=o(u),s=n(6),f=o(s);t.LOGGING_DEFAULT_OPTIONS=i.default,t.LOGGING_LEVELS=l.default,t.LOGGING_METHODS=f.default},function(e,t,n){"use strict";function o(){return"undefined"!=typeof console}function r(e){return!!(e&&e>=s.LOGGING_LEVELS.range.min&&e<=s.LOGGING_LEVELS.range.max)}function i(e){return e===s.LOGGING_LEVELS.types.none}function u(e,t){return s.LOGGING_LEVELS.types[t]>=e}function l(){var e=new Date,t=e.toDateString(),n=e.toTimeString().match(/^([0-9]{2}:[0-9]{2}:[0-9]{2})/),o=n&&n.length?n[0]:"",r=("00"+e.getMilliseconds()).slice(-3);return t+" "+o+"."+r}t.__esModule=!0;var s=n(1);t.default={isConsoleDefined:o,isLogLevelValid:r,isNoneLogLevel:i,isLoggingAllowed:u,getDateTime:l}},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0,t.singleton=t.logging=t.common=void 0;var r=n(2),i=o(r),u=n(10),l=o(u),s=n(11),f=o(s);t.common=i.default,t.logging=l.default,t.singleton=f.default},function(e,t){"use strict";t.__esModule=!0,t.default=Object.freeze({showDateTime:!1,prefix:""})},function(e,t){"use strict";t.__esModule=!0,t.default=Object.freeze({get types(){return{log:1,trace:2,debug:3,info:4,warn:5,error:6,none:7}},get range(){return{min:this.types.log,max:this.types.none}}})},function(e,t){"use strict";t.__esModule=!0,t.default=["log","trace","debug","info","warn","error"]},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var r=n(8),i=o(r),u=new i.default;t.default=u,e.exports=u},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.__esModule=!0;var l=n(3),s=n(9),f=o(s),c=function(e){function t(){return r(this,t),i(this,e.apply(this,arguments))}return u(t,e),t.prototype.noConflict=function(){return"undefined"!=typeof window&&window.clogy&&delete window.clogy,this},t.prototype.decorator=function(e){if("function"!=typeof e)throw new TypeError("Decorator should be a function");e(l.singleton.getInstance(this))},t}(f.default);t.default=c},function(e,t,n){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.__esModule=!0;var r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),u=n(1),l=n(3),s=function(){function e(){o(this,e),this._options={showDateTime:null,prefix:null},this._level=null,this._setDefaults()}return e.prototype._setDefaults=function(){this.setOptions(u.LOGGING_DEFAULT_OPTIONS),this.setLevel(this.LEVELS.info)},e.prototype.getOptions=function(){return this._options},e.prototype.setOptions=function(e){this._options=r({},this.getOptions(),e)},e.prototype.getLevel=function(){return this._level},e.prototype.setLevel=function(e){this._level="string"==typeof e?this.LEVELS[e.toLowerCase()]:e},e.prototype.stringifyAllowedLoggers=function(){var e=this,t="✔",n="✖";return u.LOGGING_METHODS.map(function(o,r){return r+1+": "+o+" "+(l.common.isLoggingAllowed(e.getLevel(),o)?t:n)}).join("\n")},e.prototype.enableAllLevels=function(){this.setLevel(this.LEVELS.log)},e.prototype.disableAllLevels=function(){this.setLevel(this.LEVELS.none)},i(e,[{key:"LEVELS",get:function(){return u.LOGGING_LEVELS.types}}]),e}(),f=s.prototype;u.LOGGING_METHODS.forEach(function(e){f[e]=function(){for(var t={currentLogLevel:this.getLevel(),loggingType:e,options:this.getOptions()},n=arguments.length,o=Array(n),r=0;r<n;r++)o[r]=arguments[r];l.logging.logToConsole(t,o)}}),t.default=s},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function r(e){var t=[];return e.showDateTime&&t.push(f.default.getDateTime()+": "),e.prefix&&t.push(e.prefix),t}function i(e,t){var n=console[e]||console[c];n&&Function.prototype.bind.call(n,console).apply(console,t)}function u(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.currentLogLevel,n=e.loggingType,o=e.options,u=void 0===o?l.LOGGING_DEFAULT_OPTIONS:o,s=arguments[1];if(f.default.isConsoleDefined()){if(!f.default.isLogLevelValid(t))throw new RangeError("Invalid LogLevel set, Please set a valid LogLevel");!f.default.isNoneLogLevel(t)&&f.default.isLoggingAllowed(t,n)&&i(n,[].concat(r(u),s))}}t.__esModule=!0;var l=n(1),s=n(2),f=o(s),c="log";t.default={logToConsole:u}},function(e,t){"use strict";function n(e){var t=Object.getPrototypeOf;return t(t(e))}function o(e){return r||(r=n(e)),r}t.__esModule=!0;var r=void 0;t.default={getInstance:o}}])}); | ||
//# sourceMappingURL=clogy.min.js.map |
{ | ||
"name": "clogy", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "A logging library for browsers and nodejs environment", | ||
@@ -33,4 +33,13 @@ "homepage": "https://github.com/pgmanutd/clogy", | ||
"dest": "dist", | ||
"lib": "lib" | ||
} | ||
"lib": "lib", | ||
"extensions": "extensions" | ||
}, | ||
"env": { | ||
"dev": "development", | ||
"prod": "production", | ||
"test": "test" | ||
}, | ||
"main": "babel.runner.js", | ||
"server": "server.babel.js", | ||
"port": 3000 | ||
}, | ||
@@ -44,3 +53,3 @@ "scripts": { | ||
"coveralls": "cat ./coverage*/*/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage", | ||
"build": "gulp clean && gulp set-dev-node-env && gulp scripts --unwatch && gulp set-prod-node-env && gulp scripts --type=production && gulp clean:directories && gulp copy", | ||
"build": "gulp clean && gulp build && gulp build --type=production && gulp copy", | ||
"patch": "gulp version:patch && npm run build && gulp year:version && npm publish", | ||
@@ -64,26 +73,29 @@ "minor": "gulp version:minor && npm run build && gulp year:version && npm publish", | ||
"devDependencies": { | ||
"babel-core": "^6.14.0", | ||
"babel-eslint": "^6.1.2", | ||
"babel-loader": "^6.2.5", | ||
"babel-plugin-istanbul": "^2.0.2", | ||
"babel-plugin-transform-flow-strip-types": "^6.14.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.8.0", | ||
"babel-polyfill": "^6.13.0", | ||
"babel-preset-es2015": "^6.14.0", | ||
"babel-preset-es2015-loose": "^8.0.0", | ||
"babel-eslint": "^7.1.1", | ||
"babel-loader": "^6.2.10", | ||
"babel-plugin-istanbul": "^3.1.2", | ||
"babel-plugin-transform-flow-strip-types": "^6.22.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.22.0", | ||
"babel-polyfill": "^6.22.0", | ||
"babel-preset-es2015": "^6.22.0", | ||
"babel-register": "^6.22.0", | ||
"chai": "^3.5.0", | ||
"coveralls": "^2.11.13", | ||
"coveralls": "^2.11.15", | ||
"del": "^2.2.2", | ||
"eslint": "^3.5.0", | ||
"eslint-plugin-flowtype": "^2.18.1", | ||
"eslint": "^3.14.1", | ||
"eslint-plugin-flowtype": "^2.30.0", | ||
"eslint-plugin-lodash-fp": "^2.1.3", | ||
"express": "^4.14.0", | ||
"flow-bin": "^0.38.0", | ||
"gulp": "^3.9.1", | ||
"gulp-bump": "^2.4.0", | ||
"gulp-bump": "^2.6.1", | ||
"gulp-eslint": "^3.0.1", | ||
"gulp-flowtype": "^1.0.0", | ||
"gulp-forever-monitor": "0.0.3", | ||
"gulp-help": "^1.6.1", | ||
"gulp-load-plugins": "^1.3.0", | ||
"gulp-load-plugins": "^1.4.0", | ||
"gulp-plumber": "^1.1.0", | ||
"gulp-replace": "^0.5.4", | ||
"gulp-util": "^3.0.7", | ||
"karma": "^1.3.0", | ||
"gulp-util": "^3.0.8", | ||
"html-webpack-plugin": "^2.26.0", | ||
"karma": "^1.4.0", | ||
"karma-babel-preprocessor": "^6.0.1", | ||
@@ -95,3 +107,3 @@ "karma-chai": "^0.1.0", | ||
"karma-ie-launcher": "^1.0.0", | ||
"karma-mocha": "^1.1.1", | ||
"karma-mocha": "^1.3.0", | ||
"karma-phantomjs-launcher": "^1.0.2", | ||
@@ -102,15 +114,17 @@ "karma-sinon": "^1.0.5", | ||
"karma-spec-reporter": "0.0.26", | ||
"karma-webpack": "^1.8.0", | ||
"lodash": "^4.15.0", | ||
"mocha": "^3.0.2", | ||
"karma-webpack": "^2.0.2", | ||
"lodash": "^4.17.4", | ||
"mocha": "^3.2.0", | ||
"path": "^0.12.7", | ||
"phantomjs-prebuilt": "^2.1.12", | ||
"phantomjs-prebuilt": "^2.1.14", | ||
"remove-empty-directories": "0.0.1", | ||
"require-dir": "^0.3.0", | ||
"require-dir": "^0.3.1", | ||
"run-sequence": "^1.2.2", | ||
"sinon": "^1.17.5", | ||
"sinon": "^1.17.7", | ||
"sinon-chai": "^2.8.0", | ||
"webpack": "^1.13.2", | ||
"yargs": "^5.0.0" | ||
"webpack": "^1.14.0", | ||
"webpack-dev-middleware": "^1.9.0", | ||
"webpack-hot-middleware": "^2.15.0", | ||
"yargs": "^6.6.0" | ||
} | ||
} |
@@ -17,3 +17,3 @@ # clogy [![npm](https://img.shields.io/npm/v/clogy.svg)](https://www.npmjs.com/package/clogy) [![Build Status](https://travis-ci.org/pgmanutd/clogy.svg?branch=master)](https://travis-ci.org/pgmanutd/clogy) [![Coverage Status](https://coveralls.io/repos/github/pgmanutd/clogy/badge.svg?branch=master)](https://coveralls.io/github/pgmanutd/clogy?branch=master) | ||
---- | ||
* Very lightweight (```~5.5KB``` minified) | ||
* Very lightweight (```~5.8KB``` minified) | ||
* No dependencies | ||
@@ -31,2 +31,3 @@ * Log at a given level (log/trace/debug/info/warn/error) to the console | ||
* Testing and Code Coverage using ```Mocha, Sinon, Chai and Istanbul``` | ||
* Extend clogy using extensions. Sample extension (```logger-with-metadata```) is present in [extensions](https://github.com/pgmanutd/clogy/blob/master/extensions) directory. Check out its [Read Me](https://github.com/pgmanutd/clogy/blob/master/extensions/README.md)! | ||
@@ -48,15 +49,15 @@ Try clogy online | ||
**rawgit**: ```//rawgit.com/pgmanutd/clogy/1.2.0/lib/clogy.js``` | ||
**rawgit**: ```//rawgit.com/pgmanutd/clogy/1.3.0/lib/clogy.js``` | ||
or | ||
**unpkg**: ```//unpkg.com/clogy@1.2.0/lib/clogy.js``` | ||
**unpkg**: ```//unpkg.com/clogy@1.3.0/lib/clogy.js``` | ||
* ```Production```: | ||
**rawgit**: ```//cdn.rawgit.com/pgmanutd/clogy/1.2.0/lib/clogy.min.js``` | ||
**rawgit**: ```//cdn.rawgit.com/pgmanutd/clogy/1.3.0/lib/clogy.min.js``` | ||
or | ||
**unpkg**: ```//unpkg.com/clogy@1.2.0/lib/clogy.min.js``` | ||
**unpkg**: ```//unpkg.com/clogy@1.3.0/lib/clogy.min.js``` | ||
@@ -302,3 +303,3 @@ | ||
---- | ||
Copyright (c) 2016 pgmanutd | ||
Copyright (c) 2017 pgmanutd | ||
@@ -305,0 +306,0 @@ Licensed under the MIT license |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119698
577
306
53