From 9af10f325e4af0115eff6e2a1ff9537fff2e2a07 Mon Sep 17 00:00:00 2001 From: Olivier Chevet Date: Sat, 11 Mar 2017 01:15:11 +0100 Subject: [PATCH] bunyan-blackhole : Initial commit for v0.2.0 (#14668) * Initial commit for v0.2.0 * added tslint compliance --- bunyan-blackhole/bunyan-blackhole-tests.ts | 26 ++++++++++++++++++++++ bunyan-blackhole/index.d.ts | 14 ++++++++++++ bunyan-blackhole/tsconfig.json | 22 ++++++++++++++++++ bunyan-blackhole/tslint.json | 1 + 4 files changed, 63 insertions(+) create mode 100644 bunyan-blackhole/bunyan-blackhole-tests.ts create mode 100644 bunyan-blackhole/index.d.ts create mode 100644 bunyan-blackhole/tsconfig.json create mode 100644 bunyan-blackhole/tslint.json diff --git a/bunyan-blackhole/bunyan-blackhole-tests.ts b/bunyan-blackhole/bunyan-blackhole-tests.ts new file mode 100644 index 0000000000..ef2096a4c8 --- /dev/null +++ b/bunyan-blackhole/bunyan-blackhole-tests.ts @@ -0,0 +1,26 @@ +import blackhole = require("bunyan-blackhole"); + + + +var logsLaboursLost = blackhole("lost"); + +const rotten = new Error("Something is rotten in the state of Denmark"); + +logsLaboursLost.info(rotten, "Play %s", "Hamlet"); +logsLaboursLost.debug(rotten, "Play %s", "King Lear"); +logsLaboursLost.trace(rotten, "Play %s", "Much Ado About Nothing"); +logsLaboursLost.warn(rotten, "Play %s", "All's Well That Ends Well"); +logsLaboursLost.error(rotten, "Play %s", "Romeo and Juliet"); + +logsLaboursLost.error("Something is rotten in the state of Denmark"); + +logsLaboursLost.debug({character: "Marcellus", play: "King Lear"}, "Friends of my soul, you twain"); +logsLaboursLost.trace({play: "All's Well That Ends Well"}, "Love all, trust a few, do wrong to none"); +logsLaboursLost.info({play: "Much Ado About Nothing"}, "Let me be that I am and seek not to alter me."); +logsLaboursLost.warn({play: "All's Well That Ends Well"}, "Love all, trust a few, do wrong to none"); +logsLaboursLost.error({play: "All's Well That Ends Well"}, "Love all, trust a few, do wrong to none"); + +var hamlet = logsLaboursLost.child({play: "Hamlet"}); +hamlet.info({character: "Polonius"}, "Though this be madness, yet there is method in't"); + + diff --git a/bunyan-blackhole/index.d.ts b/bunyan-blackhole/index.d.ts new file mode 100644 index 0000000000..f8be6fc730 --- /dev/null +++ b/bunyan-blackhole/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for bunyan-blackhole 0.2 +// Project: https://github.com/Floby/node-bunyan-blackhole +// Definitions by: Olivier Chevet +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as Logger from "bunyan"; + +/** + * Constructor. + * @param {string} [name] name of the blackhole Logger + * @return {Logger} A bunyan logger . + */ +declare function bunyanBlackHole(name: string): Logger; +export = bunyanBlackHole; diff --git a/bunyan-blackhole/tsconfig.json b/bunyan-blackhole/tsconfig.json new file mode 100644 index 0000000000..cddd529d29 --- /dev/null +++ b/bunyan-blackhole/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bunyan-blackhole-tests.ts" + ] +} \ No newline at end of file diff --git a/bunyan-blackhole/tslint.json b/bunyan-blackhole/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/bunyan-blackhole/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file