loglevel-mixin
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -39,3 +39,3 @@ /* jslint node: true, esnext: true */ | ||
* the log level of the called logging function. | ||
* By default a method log(leve,message) will be used | ||
* By default a method log(level,message) will be used | ||
*/ | ||
@@ -81,3 +81,3 @@ exports.defineLoggerMethods = function (object, logLevels, theFunction) { | ||
* @param {Object} logLevels Hash with all the available loglevels. Stored by there name | ||
* @param {String} defaultLogLevel the default value for the properties | ||
* @param {String} defaultLogLevel the default value for the logLevel property | ||
*/ | ||
@@ -93,2 +93,7 @@ exports.LogLevelMixin = (superclass, logLevels, defaultLogLevel) => class extends superclass { | ||
} | ||
/** | ||
* Set the logging level | ||
* @param {String} level | ||
*/ | ||
set logLevel(level) { | ||
@@ -134,1 +139,16 @@ this._logLevel = logLevels[level] || defaultLogLevel; | ||
}; | ||
exports.makeLogEvent = function (level, arg, args) { | ||
const logevent = { | ||
"timestamp": Date.now(), | ||
"level": level | ||
}; | ||
if (typeof arg === 'string') { | ||
logevent.message = arg; | ||
return Object.assign(logevent, args); | ||
} else { | ||
return Object.assign(logevent, arg, args); | ||
} | ||
}; |
@@ -23,2 +23,3 @@ { | ||
"cracks": "3.1.1", | ||
"cz-conventional-changelog": "^1.1.5", | ||
"istanbul": "0.4.1", | ||
@@ -38,3 +39,8 @@ "jsdoc": "3.4.0", | ||
"homepage": "https://github.com/arlac77/loglevel-mixin#readme", | ||
"version": "1.1.0" | ||
"config": { | ||
"commitizen": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
} | ||
}, | ||
"version": "1.2.0" | ||
} |
loglevel-mixin | ||
============== | ||
[![npm](https://img.shields.io/npm/v/loglevel-mixin.svg)](https://www.npmjs.com/package/loglevel-mixin)[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/arlac77/loglevel-mixin)[![Build Status](https://secure.travis-ci.org/arlac77/loglevel-mixin.png)](http://travis-ci.org/arlac77/loglevel-mixin)[![Coverage Status](https://coveralls.io/repos/arlac77/loglevel-mixin/badge.svg)](https://coveralls.io/r/arlac77/loglevel-mixin)[![Code Climate](https://codeclimate.com/github/arlac77/loglevel-mixin/badges/gpa.svg)](https://codeclimate.com/github/arlac77/loglevel-mixin)[![GitHub Issues](https://img.shields.io/github/issues/arlac77/loglevel-mixin.svg?style=flat-square)](https://github.com/arlac77/loglevel-mixin/issues)[![Dependency Status](https://david-dm.org/arlac77/loglevel-mixin.svg)](https://david-dm.org/arlac77/loglevel-mixin)[![devDependency Status](https://david-dm.org/arlac77/loglevel-mixin/dev-status.svg)](https://david-dm.org/arlac77/loglevel-mixin#info=devDependencies)[![docs](http://inch-ci.org/github/arlac77/loglevel-mixin.svg?branch=master)](http://inch-ci.org/github/arlac77/loglevel-mixin)[![downloads](http://img.shields.io/npm/dm/loglevel-mixin.svg?style=flat-square)](https://npmjs.org/package/loglevel-mixin) | ||
[![npm](https://img.shields.io/npm/v/loglevel-mixin.svg)](https://www.npmjs.com/package/loglevel-mixin) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/arlac77/loglevel-mixin) | ||
[![Build Status](https://secure.travis-ci.org/arlac77/loglevel-mixin.png)](http://travis-ci.org/arlac77/loglevel-mixin) | ||
[![bithound](https://www.bithound.io/github/arlac77/loglevel-mixin/badges/score.svg)](https://www.bithound.io/github/arlac77/loglevel-mixin) | ||
[![Coverage Status](https://coveralls.io/repos/arlac77/loglevel-mixin/badge.svg)](https://coveralls.io/r/arlac77/loglevel-mixin) | ||
[![codecov.io](http://codecov.io/github/arlac77/loglevel-mixin/coverage.svg?branch=master)](http://codecov.io/github/arlac77/loglevel-mixin?branch=master) | ||
[![Code Climate](https://codeclimate.com/github/arlac77/loglevel-mixin/badges/gpa.svg)](https://codeclimate.com/github/arlac77/loglevel-mixin) | ||
[![GitHub Issues](https://img.shields.io/github/issues/arlac77/loglevel-mixin.svg?style=flat-square)](https://github.com/arlac77/loglevel-mixin/issues) | ||
[![Dependency Status](https://david-dm.org/arlac77/loglevel-mixin.svg)](https://david-dm.org/arlac77/loglevel-mixin) | ||
[![devDependency Status](https://david-dm.org/arlac77/loglevel-mixin/dev-status.svg)](https://david-dm.org/arlac77/loglevel-mixin#info=devDependencies) | ||
[![docs](http://inch-ci.org/github/arlac77/loglevel-mixin.svg?branch=master)](http://inch-ci.org/github/arlac77/loglevel-mixin) | ||
[![downloads](http://img.shields.io/npm/dm/loglevel-mixin.svg?style=flat-square)](https://npmjs.org/package/loglevel-mixin) | ||
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) | ||
@@ -11,3 +23,3 @@ Injects methods named after a set of logLevels which are only forwarding messages if the current logLevel is higher or equal to the logLevel the name of the called method reflects. | ||
``` | ||
```javascript | ||
const llm = require(`loglevel-mixin`); | ||
@@ -30,6 +42,6 @@ | ||
for es6 classes to | ||
works for es6 classes to | ||
------------------ | ||
``` | ||
```javascript | ||
const llm = require(`loglevel-mixin`); | ||
@@ -59,3 +71,3 @@ | ||
``` | ||
```shell | ||
npm install loglevel-mixin | ||
@@ -68,1 +80,4 @@ ``` | ||
BSD-2-Clause | ||
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/arlac77/loglevel-mixin/trend.png)](https://bitdeli.com/free "Bitdeli Badge") |
@@ -23,3 +23,3 @@ /* global describe, it*/ | ||
class LoggingEnabledBaseClass extends llm.LogLevelMixin(BaseClass, llm.defaultLogLevels, | ||
llm.defaultLogLevels['info']) { | ||
llm.defaultLogLevels.info) { | ||
log(level, message) { | ||
@@ -70,3 +70,3 @@ theLevel = level; | ||
it('error passes', function () { | ||
someObject.error(level => "error message"); | ||
someObject.error("error message"); | ||
assert.equal(theValue, 'error message'); | ||
@@ -73,0 +73,0 @@ assert.equal(theLevel, 'error'); |
@@ -72,3 +72,3 @@ /* global describe, it*/ | ||
it('error passes', function () { | ||
someObject.error(level => "error message"); | ||
someObject.error("error message"); | ||
assert.equal(theValue, 'error message'); | ||
@@ -75,0 +75,0 @@ assert.equal(theLevel, 'error'); |
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
16000
9
281
80
9