@jalik/logger
Advanced tools
Comparing version 2.2.1 to 2.2.2
# Changelog | ||
## v2.2.2 | ||
- Updates dependencies | ||
## v2.2.1 | ||
@@ -4,0 +7,0 @@ - Updates dependencies |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _deepExtend = _interopRequireDefault(require("@jalik/deep-extend")); | ||
@@ -14,12 +22,26 @@ | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2019 Karl STEIN | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
* | ||
*/ | ||
var Logger = | ||
@@ -29,6 +51,5 @@ /*#__PURE__*/ | ||
function Logger(options) { | ||
_classCallCheck(this, Logger); | ||
(0, _classCallCheck2["default"])(this, Logger); | ||
// Set default options | ||
this.options = (0, _deepExtend.default)({ | ||
this.options = (0, _deepExtend["default"])({ | ||
active: true, | ||
@@ -47,5 +68,5 @@ console: { | ||
this.observer = new _observer.default(this); // Check console availability | ||
this.observer = new _observer["default"](this); // Check console availability | ||
if ((typeof console === "undefined" ? "undefined" : _typeof(console)) !== 'object' || console === null) { | ||
if ((typeof console === "undefined" ? "undefined" : (0, _typeof2["default"])(console)) !== 'object' || console === null) { | ||
throw new Error('The console object is not available in this environment.'); | ||
@@ -97,3 +118,3 @@ } // Add polyfill methods to the console object | ||
_createClass(Logger, [{ | ||
(0, _createClass2["default"])(Logger, [{ | ||
key: "clone", | ||
@@ -114,3 +135,3 @@ value: function clone(name) { | ||
value: function debug(message, context) { | ||
this.log(message, _types.default.debug, context); | ||
this.log(message, _types["default"].debug, context); | ||
} | ||
@@ -143,3 +164,3 @@ /** | ||
this.log(msg, _types.default.error, ctx); | ||
this.log(msg, _types["default"].error, ctx); | ||
} | ||
@@ -165,3 +186,3 @@ /** | ||
value: function info(message, context) { | ||
this.log(message, _types.default.info, context); | ||
this.log(message, _types["default"].info, context); | ||
} | ||
@@ -206,3 +227,3 @@ /** | ||
switch (type) { | ||
case _types.default.debug: | ||
case _types["default"].debug: | ||
if (this.options.console.debug === true) { | ||
@@ -217,3 +238,3 @@ var _console; | ||
case _types.default.error: | ||
case _types["default"].error: | ||
if (this.options.console.error === true) { | ||
@@ -228,3 +249,3 @@ var _console2; | ||
case _types.default.info: | ||
case _types["default"].info: | ||
if (this.options.console.info === true) { | ||
@@ -239,3 +260,3 @@ var _console3; | ||
case _types.default.warning: | ||
case _types["default"].warning: | ||
if (this.options.console.warning === true) { | ||
@@ -305,6 +326,5 @@ var _console4; | ||
value: function warn(message, context) { | ||
this.log(message, _types.default.warning, context); | ||
this.log(message, _types["default"].warning, context); | ||
} | ||
}]); | ||
return Logger; | ||
@@ -314,2 +334,2 @@ }(); | ||
var _default = Logger; | ||
exports.default = _default; | ||
exports["default"] = _default; |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
@@ -54,2 +54,2 @@ /* | ||
}; | ||
exports.default = _default; | ||
exports["default"] = _default; |
{ | ||
"name": "@jalik/logger", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "A logging utility to log messages to anywhere.", | ||
@@ -35,23 +35,22 @@ "license": "MIT", | ||
"dependencies": { | ||
"@jalik/deep-extend": "^1.1.2", | ||
"@jalik/observer": "^1.1.2" | ||
"@jalik/deep-extend": "^1.1.3", | ||
"@jalik/observer": "^1.1.3" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.3.4", | ||
"@babel/preset-env": "^7.3.4", | ||
"acorn": "^6.1.0", | ||
"ajv": "^6.9.2", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"del": "^3.0.0", | ||
"eslint": "^5.14.1", | ||
"eslint-config-airbnb": "^17.1.0", | ||
"eslint-plugin-import": "^2.16.0", | ||
"eslint-plugin-jest": "^22.3.0", | ||
"eslint-plugin-jsx-a11y": "^6.2.1", | ||
"eslint-plugin-react": "^7.12.4", | ||
"gulp": "^4.0.0", | ||
"@babel/core": "^7.5.5", | ||
"acorn": "^6.2.1", | ||
"ajv": "^6.10.2", | ||
"babel-preset-airbnb": "^4.0.1", | ||
"del": "^5.0.0", | ||
"eslint": "^5.16.0", | ||
"eslint-config-airbnb": "^17.1.1", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-jest": "^22.13.6", | ||
"eslint-plugin-jsx-a11y": "^6.2.3", | ||
"eslint-plugin-react": "^7.14.3", | ||
"gulp": "^4.0.2", | ||
"gulp-babel": "^8.0.0", | ||
"gulp-eslint": "^5.0.0", | ||
"jest": "^24.1.0" | ||
"jest": "^24.8.0" | ||
} | ||
} |
# @jalik/logger | ||
![GitHub package.json version](https://img.shields.io/github/package-json/v/jalik/js-logger.svg) | ||
[![Build Status](https://travis-ci.com/jalik/js-logger.svg?branch=master)](https://travis-ci.com/jalik/js-logger) | ||
![GitHub](https://img.shields.io/github/license/jalik/js-logger.svg) | ||
![GitHub last commit](https://img.shields.io/github/last-commit/jalik/js-logger.svg) | ||
[![GitHub issues](https://img.shields.io/github/issues/jalik/js-logger.svg)](https://github.com/jalik/js-logger/issues) | ||
![npm](https://img.shields.io/npm/dt/@jalik/logger.svg) | ||
@@ -9,4 +15,2 @@ A flexible logger to log messages to anything you want (console, file, database...), there's nothing more to say about it. | ||
**This library is unit tested.** | ||
## Creating a logger | ||
@@ -13,0 +17,0 @@ |
28252
15
9
580
165
Updated@jalik/deep-extend@^1.1.3
Updated@jalik/observer@^1.1.3