Skip to content

Commit

Permalink
feat(winston): add TS types (#88)
Browse files Browse the repository at this point in the history
Based on #82 which added types for Pino.
  • Loading branch information
dliv authored Aug 23, 2021
1 parent 9171ce5 commit f8552a5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions loggers/winston/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { Format } from "winston";

interface Config {
/**
* Whether to convert a logged `err` field to ECS error fields.
* Default true.
*/
convertErr?: boolean;
/**
* Whether to convert logged `req` and `res` HTTP request and response fields
* to ECS HTTP, User agent, and URL fields. Default false.
*/
convertReqRes?: boolean;
/**
* Whether to automatically integrate with
* Elastic APM (https://github.com/elastic/apm-agent-nodejs). If a started
* APM agent is detected, then log records will include the following
* fields:
*
* - "service.name" - the configured serviceName in the agent
* - "event.dataset" - set to "$serviceName.log" for correlation in Kibana
* - "trace.id", "transaction.id", and "span.id" - if there is a current
* active trace when the log call is made
*
* Default true.
*/
apmIntegration?: boolean;
}

export = (opts?: Config) => Format
1 change: 1 addition & 0 deletions loggers/winston/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.1.0",
"description": "A formatter for the winston logger compatible with Elastic Common Schema.",
"main": "index.js",
"types": "index.d.ts",
"files": [
"index.js"
],
Expand Down

0 comments on commit f8552a5

Please sign in to comment.