Skip to content

Commit

Permalink
Add TypeScript types
Browse files Browse the repository at this point in the history
  • Loading branch information
mjwwit committed Mar 15, 2019
1 parent 2a6a50c commit d8d83c6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -4,6 +4,7 @@
"description": "A transport for pino that sends messages to Google Stackdriver Logging",
"homepage": "https://github.com/ovhemert/pino-stackdriver",
"main": "src/index.js",
"types": "pino-stackdriver.d.ts",
"scripts": {
"dev:cli": "node ./test/debug.js | node ./src/cli.js",
"lint": "standard",
Expand Down
39 changes: 39 additions & 0 deletions pino-stackdriver.d.ts
@@ -0,0 +1,39 @@
declare module "pino-stackdriver" {
namespace PinoStackdriver {
interface Options {
/**
* Full path to the JSON file containing the Google Service Credentials.
* Required if GOOGLE_APPLICATION_CREDENTIALS is not set as an environment variable.
*/
credentials?: string;

/**
* The name of the project.
*/
projectId: string;

/**
* The name of the log.
* @default "pino_log"
*/
logName?: string;

/**
* The MonitoringResource to send logs to.
* @default { type: "global" }
*/
resource?: {
type: string;
labels?: Record<string, string>;
}
}

/**
* Create a writestream that `pino-multi-stream` can use to send logs to.
* @param options
*/
export const createWriteStream = (options: Options) => NodeJS.WritableStream;
}

export = PinoStackdriver;
}

0 comments on commit d8d83c6

Please sign in to comment.