Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@workpop/simple-logger

Package Overview
Dependencies
Maintainers
14
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@workpop/simple-logger - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

__tests__/logger.test.js

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="1.1.0"></a>
# [1.1.0](https://github.com/Workpop/simple-logger/compare/v1.0.1...v1.1.0) (2018-01-30)
### Features
* **reqId:** req id ([58b581f](https://github.com/Workpop/simple-logger/commit/58b581f))
<a name="1.0.1"></a>

@@ -7,0 +17,0 @@ ## [1.0.1](https://github.com/Workpop/simple-logger/compare/v1.0.0...v1.0.1) (2018-01-15)

57

lib/index.js

@@ -16,2 +16,9 @@ 'use strict';

var logLevels = {
TRACE: 'TRACE',
INFO: 'INFO',
WARN: 'WARN',
ERROR: 'ERROR'
};
function _log(category, level) {

@@ -26,3 +33,3 @@ var _console2;

if (level === 'ERROR') {
if (level === logLevels.ERROR) {
var _console;

@@ -36,41 +43,31 @@

function Logger(category) {
function Logger(category, requestId) {
this.category = category;
this.requestId = requestId;
}
Logger.prototype.trace = function trace() {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
function createLogLevel(level) {
return function logWithLevel() {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
_log.apply(undefined, [this.category, 'TRACE'].concat(args));
};
if (this.requestId) {
_log.apply(undefined, [this.category, level, 'RequestId: ' + this.requestId].concat(args));
}
_log.apply(undefined, [this.category, level].concat(args));
};
}
Logger.prototype.info = function info() {
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
Logger.prototype.trace = createLogLevel(logLevels.TRACE);
_log.apply(undefined, [this.category, 'INFO '].concat(args));
};
Logger.prototype.info = createLogLevel(logLevels.INFO);
Logger.prototype.warn = function warn() {
for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
Logger.prototype.warn = createLogLevel(logLevels.WARN);
_log.apply(undefined, [this.category, 'WARN '].concat(args));
};
Logger.prototype.error = createLogLevel(logLevels.ERROR);
Logger.prototype.error = function error() {
for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
args[_key5] = arguments[_key5];
}
_log.apply(undefined, [this.category, 'ERROR'].concat(args));
};
Logger.prototype.log = function log(level) {
for (var _len6 = arguments.length, args = Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
args[_key6 - 1] = arguments[_key6];
for (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
args[_key3 - 1] = arguments[_key3];
}

@@ -77,0 +74,0 @@

{
"name": "@workpop/simple-logger",
"version": "1.0.1",
"version": "1.1.0",
"description": "Simple console logger",

@@ -13,3 +13,5 @@ "main": "lib/index.js",

"flow": "flow check",
"release": "standard-version"
"release": "standard-version",
"testonly": "mocha ./__tests__/**/*.test.js --compilers js:babel-register",
"test:watch": "npm run testonly -- --watch --watch-extensions js"
},

@@ -30,6 +32,9 @@ "dependencies": {

"babel-preset-stage-0": "^6.22.0",
"chai": "^4.1.2",
"eslint": "^3.16.1",
"flow-bin": "^0.40.0",
"mocha": "^5.0.0",
"sinon": "^4.2.2",
"standard-version": "^4.0.0"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc