diff --git a/types/datadog-winston/datadog-winston-tests.ts b/types/datadog-winston/datadog-winston-tests.ts new file mode 100644 index 0000000000..4795fee12a --- /dev/null +++ b/types/datadog-winston/datadog-winston-tests.ts @@ -0,0 +1,12 @@ +import DatadogWinston = require("datadog-winston"); + +const options: DatadogWinston.DatadogTransportOptions = { + apiKey: '', + ddsource: 'node.js', + ddtags: 'key:value', + hostname: 'hostname', + level: 'error', + service: 'service', +}; + +const logger = new DatadogWinston(options); diff --git a/types/datadog-winston/index.d.ts b/types/datadog-winston/index.d.ts new file mode 100644 index 0000000000..7816c66b42 --- /dev/null +++ b/types/datadog-winston/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for datadog-winston 1.0 +// Project: https://github.com/itsfadnis/datadog-winston +// Definitions by: Matt Hintzke +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +import * as Transport from "winston-transport"; + +declare namespace DatadogWinston { + interface DatadogTransportOptions extends Transport.TransportStreamOptions { + apiKey: string; + hostname?: string; + service?: string; + ddsource?: string; + ddtags?: string; + } +} + +declare class DatadogWinston extends Transport { + constructor(options: DatadogWinston.DatadogTransportOptions); + + log?(info: any, next: () => void): void; +} + +export = DatadogWinston; diff --git a/types/datadog-winston/package.json b/types/datadog-winston/package.json new file mode 100644 index 0000000000..ae2c526fc1 --- /dev/null +++ b/types/datadog-winston/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "winston-transport": "^4.3.0" + } +} diff --git a/types/datadog-winston/tsconfig.json b/types/datadog-winston/tsconfig.json new file mode 100644 index 0000000000..ef82da74e4 --- /dev/null +++ b/types/datadog-winston/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "datadog-winston-tests.ts" + ] +} diff --git a/types/datadog-winston/tslint.json b/types/datadog-winston/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/datadog-winston/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }