Comparing version 1.0.11 to 1.0.12
@@ -20,7 +20,12 @@ export declare namespace nxLogger { | ||
type TransportFn = (configuration: Config, messages: Message[]) => Result; | ||
type Formatter = (format: string, args: any[]) => string; | ||
type Inspect = (object: any, options?: any) => string; | ||
type Handler = (message: Message, callback: Function) => Function; | ||
type HandlerFactory = (log: Log) => Handler; | ||
interface Log { | ||
(message: Message): Result; | ||
(message: any): Result; | ||
(message: Message, ...messages: any[]): Result; | ||
readonly configuration: Config; | ||
create: SimplyFactoryFn; | ||
on: (message: Message, callback: Function) => Function; | ||
on: Handler; | ||
} | ||
@@ -27,0 +32,0 @@ type FactoryFn = (configuration: ConfigPartial) => Log; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const util = require("util"); | ||
const formatter = (format, args) => util.format(format, ...args); | ||
const inspect = (object, options = {}) => typeof object === 'string' ? | ||
object : util.inspect(object, options); | ||
const transport = (config, messages) => { | ||
const namespace = config.namespace.join(':'); | ||
const [format, ...args] = messages; | ||
const message = messages.length > 1 ? formatter(format, args) : inspect(messages[0]); | ||
console.log(`${namespace} - ${message}`); | ||
}; | ||
// Global LogConfig | ||
@@ -7,3 +17,3 @@ const baseConfiguration = { | ||
namespace: [], | ||
transport: (config, messages) => console.log(`${config.namespace.join(':')} - ${messages.join(' ')}`), | ||
transport, | ||
tty: true, | ||
@@ -35,2 +45,3 @@ }; | ||
log.create = logFactoryCreator(configuration); | ||
log.on = logHandlerFactory(log); | ||
return log; | ||
@@ -43,2 +54,6 @@ }; | ||
}; | ||
const logHandlerFactory = log => (message, callback) => (...args) => { | ||
log(message, args); | ||
return callback(...args); | ||
}; | ||
exports.create = logFactory(baseConfiguration).create; |
{ | ||
"author": "Tobias Kopelke <nox@raynode.de>", | ||
"dependencies": {}, | ||
"dependencies": { | ||
"cpx": "^1.5.0" | ||
}, | ||
"description": "", | ||
"devDependencies": { | ||
"@types/faker": "^4.1.0", | ||
"@types/mocha": "^2.2.41", | ||
"@types/node": "^7.0.31", | ||
"typescript": "^2.3.4" | ||
"@types/sinon": "^2.3.1", | ||
"ava": "^0.19.1", | ||
"faker": "^4.1.0", | ||
"mocha": "^3.4.2", | ||
"npm-scripts-info": "^0.3.6", | ||
"sinon": "^2.3.4", | ||
"ts-mocha": "^1.0.3", | ||
"ts-node": "^3.0.6", | ||
"typescript": "^2.3.4", | ||
"unexpected": "^10.29.0" | ||
}, | ||
@@ -25,11 +38,27 @@ "files": [ | ||
"scripts": { | ||
"build": "tsc", | ||
"info": "npm-scripts-info", | ||
"build": "tsc -p tsconfig.build.json", | ||
"prepare": "npm run build", | ||
"preupload": "npm version patch", | ||
"postupload": "git push", | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"test": "ts-mocha -p tsconfig.json tests/*.spec.ts", | ||
"upload": "npm publish" | ||
}, | ||
"scripts-info": { | ||
"info": "Display information about the scripts", | ||
"build": "(Trash and re)build the library", | ||
"lint": "Lint all typescript source files", | ||
"unit": "Build the library and run unit tests", | ||
"test": "Lint, build, and test the library", | ||
"watch": "Watch source files, rebuild library on changes, rerun relevant tests", | ||
"cov": "Run tests, generate the HTML coverage report, and open it in a browser", | ||
"docs": "Generate HTML API documentation and open it in a browser", | ||
"docs:publish": "Generate HTML API documentation and push it to GitHub Pages", | ||
"docs:json": "Generate API documentation in typedoc JSON format", | ||
"changelog": "Bump package.json version, update CHANGELOG.md, tag a release", | ||
"reset": "Delete all untracked files and reset the repo to the last commit", | ||
"release": "Clean, build, test, publish docs, and prepare release (a one-step publish process)" | ||
}, | ||
"types": "dist/log.d.ts", | ||
"version": "1.0.11" | ||
"version": "1.0.12" | ||
} |
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
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
5595
97
1
1
13
+ Addedcpx@^1.5.0
+ Addedanymatch@1.3.2(transitive)
+ Addedarr-diff@2.0.04.0.0(transitive)
+ Addedarr-flatten@1.1.0(transitive)
+ Addedarr-union@3.1.0(transitive)
+ Addedarray-unique@0.2.10.3.2(transitive)
+ Addedassign-symbols@1.0.0(transitive)
+ Addedasync-each@1.0.6(transitive)
+ Addedatob@2.1.2(transitive)
+ Addedbabel-runtime@6.26.0(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbase@0.11.2(transitive)
+ Addedbinary-extensions@1.13.1(transitive)
+ Addedbindings@1.5.0(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbraces@1.8.52.3.2(transitive)
+ Addedcache-base@1.0.1(transitive)
+ Addedchokidar@1.7.0(transitive)
+ Addedclass-utils@0.3.6(transitive)
+ Addedcollection-visit@1.0.0(transitive)
+ Addedcomponent-emitter@1.3.1(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcopy-descriptor@0.1.1(transitive)
+ Addedcore-js@2.6.12(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addedcpx@1.5.0(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addeddecode-uri-component@0.2.2(transitive)
+ Addeddefine-property@0.2.51.0.02.0.2(transitive)
+ Addedduplexer@0.1.2(transitive)
+ Addedexpand-brackets@0.1.52.1.4(transitive)
+ Addedexpand-range@1.8.2(transitive)
+ Addedextend-shallow@2.0.13.0.2(transitive)
+ Addedextglob@0.3.22.0.4(transitive)
+ Addedfile-uri-to-path@1.0.0(transitive)
+ Addedfilename-regex@2.0.1(transitive)
+ Addedfill-range@2.2.44.0.0(transitive)
+ Addedfind-index@0.1.1(transitive)
+ Addedfor-in@1.0.2(transitive)
+ Addedfor-own@0.1.5(transitive)
+ Addedfragment-cache@0.2.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfsevents@1.2.13(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-value@2.0.6(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedglob-base@0.3.0(transitive)
+ Addedglob-parent@2.0.0(transitive)
+ Addedglob2base@0.0.12(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhas-value@0.3.11.0.0(transitive)
+ Addedhas-values@0.1.41.0.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-accessor-descriptor@1.0.1(transitive)
+ Addedis-binary-path@1.0.1(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedis-data-descriptor@1.0.1(transitive)
+ Addedis-descriptor@0.1.71.0.3(transitive)
+ Addedis-dotfile@1.0.3(transitive)
+ Addedis-equal-shallow@0.1.3(transitive)
+ Addedis-extendable@0.1.11.0.1(transitive)
+ Addedis-extglob@1.0.0(transitive)
+ Addedis-glob@2.0.1(transitive)
+ Addedis-number@2.1.03.0.04.0.0(transitive)
+ Addedis-plain-object@2.0.4(transitive)
+ Addedis-posix-bracket@0.1.1(transitive)
+ Addedis-primitive@2.0.0(transitive)
+ Addedis-windows@1.0.2(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedisobject@2.1.03.0.1(transitive)
+ Addedkind-of@3.2.24.0.06.0.3(transitive)
+ Addedmap-cache@0.2.2(transitive)
+ Addedmap-visit@1.0.0(transitive)
+ Addedmath-random@1.0.4(transitive)
+ Addedmicromatch@2.3.113.1.10(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmixin-deep@1.3.2(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedms@2.0.0(transitive)
+ Addednan@2.22.0(transitive)
+ Addednanomatch@1.2.13(transitive)
+ Addednormalize-path@2.1.1(transitive)
+ Addedobject-copy@0.1.0(transitive)
+ Addedobject-visit@1.0.1(transitive)
+ Addedobject.omit@2.0.1(transitive)
+ Addedobject.pick@1.3.0(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedparse-glob@3.0.4(transitive)
+ Addedpascalcase@0.1.1(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedposix-character-classes@0.1.1(transitive)
+ Addedpreserve@0.2.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedrandomatic@3.1.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedreaddirp@2.2.1(transitive)
+ Addedregenerator-runtime@0.11.1(transitive)
+ Addedregex-cache@0.4.4(transitive)
+ Addedregex-not@1.0.2(transitive)
+ Addedremove-trailing-separator@1.1.0(transitive)
+ Addedrepeat-element@1.1.4(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedresolve-url@0.2.1(transitive)
+ Addedret@0.1.15(transitive)
+ Addedsafe-buffer@5.1.25.2.1(transitive)
+ Addedsafe-regex@1.1.0(transitive)
+ Addedset-value@2.0.1(transitive)
+ Addedshell-quote@1.8.2(transitive)
+ Addedsnapdragon@0.8.2(transitive)
+ Addedsnapdragon-node@2.1.1(transitive)
+ Addedsnapdragon-util@3.0.1(transitive)
+ Addedsource-map@0.5.7(transitive)
+ Addedsource-map-resolve@0.5.3(transitive)
+ Addedsource-map-url@0.4.1(transitive)
+ Addedsplit-string@3.1.0(transitive)
+ Addedstatic-extend@0.1.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedsubarg@1.0.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedto-object-path@0.3.0(transitive)
+ Addedto-regex@3.0.2(transitive)
+ Addedto-regex-range@2.1.1(transitive)
+ Addedunion-value@1.0.1(transitive)
+ Addedunset-value@1.0.0(transitive)
+ Addedurix@0.1.0(transitive)
+ Addeduse@3.1.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwrappy@1.0.2(transitive)