Full Code of winstonjs/winston for AI

master ed45345f01b8 cached
114 files
413.0 KB
108.1k tokens
169 symbols
1 requests
Download .txt
Showing preview only (442K chars total). Download the full file or copy to clipboard to get everything.
Repository: winstonjs/winston
Branch: master
Commit: ed45345f01b8
Files: 114
Total size: 413.0 KB

Directory structure:
gitextract_0r69vkma/

├── .babelrc
├── .editorconfig
├── .eslintrc
├── .gitattributes
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.yml
│   │   ├── config.yml
│   │   └── feature_request.yml
│   ├── dependabot.yml
│   └── workflows/
│       └── ci.yml
├── .gitignore
├── .npmignore
├── .prettierrc
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── UPGRADE-3.0.md
├── docs/
│   ├── publishing.md
│   ├── releases.md
│   └── transports.md
├── examples/
│   ├── color-message.js
│   ├── create-file.js
│   ├── custom-levels-colors.js
│   ├── custom-levels.js
│   ├── custom-pretty-print.js
│   ├── custom-timestamp.js
│   ├── custom-transport.js
│   ├── delete-level.js
│   ├── errors.js
│   ├── exception.js
│   ├── file-maxsize.js
│   ├── finish-event.js
│   ├── format-dynamic-content.js
│   ├── format-filter.js
│   ├── format-logger-and-transport.js
│   ├── format-mutate.js
│   ├── interpolation.js
│   ├── json.js
│   ├── levels.js
│   ├── metadata.js
│   ├── quick-start.js
│   ├── ready-to-use-pattern.ts
│   ├── regular-expressions.js
│   ├── simple-stream.js
│   ├── splat-message.js
│   └── splat.js
├── index.d.ts
├── jest.config.js
├── lib/
│   ├── winston/
│   │   ├── common.js
│   │   ├── config/
│   │   │   ├── index.d.ts
│   │   │   └── index.js
│   │   ├── container.js
│   │   ├── create-logger.js
│   │   ├── exception-handler.js
│   │   ├── exception-stream.js
│   │   ├── logger.js
│   │   ├── profiler.js
│   │   ├── rejection-handler.js
│   │   ├── rejection-stream.js
│   │   ├── tail-file.js
│   │   └── transports/
│   │       ├── console.js
│   │       ├── file.js
│   │       ├── http.js
│   │       ├── index.d.ts
│   │       ├── index.js
│   │       └── stream.js
│   └── winston.js
├── package.json
├── publishing.md
├── test/
│   ├── fixtures/
│   │   ├── .gitkeep
│   │   ├── keys/
│   │   │   ├── agent2-cert.pem
│   │   │   └── agent2-key.pem
│   │   └── logs/
│   │       └── .gitkeep
│   ├── globalSetup.js
│   ├── helpers/
│   │   ├── handler-tests.js
│   │   ├── index.js
│   │   ├── mocks/
│   │   │   ├── legacy-mixed-transport.js
│   │   │   ├── legacy-transport.js
│   │   │   └── mock-transport.js
│   │   └── scripts/
│   │       ├── colorize.js
│   │       ├── default-rejections.js
│   │       ├── exit-on-error.js
│   │       ├── log-rejections.js
│   │       ├── unhandle-exceptions.js
│   │       └── unhandle-rejections.js
│   ├── integration/
│   │   ├── formats.test.js
│   │   └── logger.test.js
│   ├── jest.config.integration.js
│   ├── jest.config.unit.js
│   ├── tsconfig.json
│   ├── typescript-definitions.ts
│   └── unit/
│       ├── formats/
│       │   └── errors.test.js
│       └── winston/
│           ├── config/
│           │   └── config.test.js
│           ├── container.test.js
│           ├── create-logger.test.js
│           ├── exception-handler.test.js
│           ├── exception-stream.test.js
│           ├── log-exception.test.js
│           ├── logger-legacy.test.js
│           ├── logger.test.js
│           ├── profiler.test.js
│           ├── rejection-handler.test.js
│           ├── tail-file.test.js
│           ├── transports/
│           │   ├── 00-file-stress.test.js
│           │   ├── console.test.js
│           │   ├── error.test.js
│           │   ├── file-create-dir.test.js
│           │   ├── file.test.js
│           │   ├── http.test.js
│           │   └── stream.test.js
│           └── winston.test.js
└── tsconfig.json

================================================
FILE CONTENTS
================================================

================================================
FILE: .babelrc
================================================
{
  "presets": ["@babel/preset-env"]
}


================================================
FILE: .editorconfig
================================================
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# default configuration
[*]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

# Tab indentation (no size specified)
[Makefile]
indent_style = tab


================================================
FILE: .eslintrc
================================================
{
  "env": {
    "jest": true,
  },
  "extends": "@dabh/eslint-config-populist",
  "rules": {
    "one-var": ["error", { "var": "never", "let": "never", "const": "never" }],
    "strict": 0
  },
  "parserOptions": {
    "ecmaVersion": 2022,
  },
}


================================================
FILE: .gitattributes
================================================
package-lock.json binary


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.yml
================================================
name: Have you encountered an issue?
description: Report an issue with Winston.
title: "[Bug]: "
labels: ["Bug", "Needs Investigation"]
body:
  - type: markdown # Form Header
    attributes:
      value: >-
        This issue form is for reporting bugs only!
  - type: input # Search Terms
    validations:
      required: true
    attributes:
      label: 🔎 Search Terms
      description: >-
        What search terms did you use when trying to find an existing bug report, looking in both open and closed issues?
        List them here (comma seperated) so people in the future can find this one more easily.
  - type: textarea # Problem Definition
    validations:
      required: true
    attributes:
      label: The problem
      description: >-
        Please provide a clear and concise description of the problem you've encountered and what the
        expected behavior was.
  - type: markdown # Environment Section Header
    attributes:
      value: |
        ## Environment
  - type: input # Affected Version Input
    id: winston-version
    validations:
      required: true
    attributes:
      label: What version of Winston presents the issue?
      placeholder: v3.4.0
      description: >
        Can be found by running one of the following (depending on your package manager of choice):
        - `npm list winston`
        - `yarn list --pattern winston`
  - type: input # Affected Version Input
    id: node-version
    validations:
      required: true
    attributes:
      label: What version of Node are you using?
      placeholder: v16.8.0
      description: >
        Can be found by running the following: `node -v`
  - type: input # Last Known Working Version
    attributes:
      label: If this worked in a previous version of Winston, which was it?
      placeholder: v3.0.0
      description: >
        If known, otherwise please leave blank.
  - type: markdown # Details Section Header
    attributes:
      value: |
        # Details
  - type: textarea # Minimum Working Example Input
    attributes:
      label: Minimum Working Example
      description: |
        If you can, providing an MWE to reproduce the issue you're encountering can greatly speed up
        investigation into the issue by one of our maintainers, or anyone else in the community who's looking
        to get involved.

        This can be as simple as a script, a link to a repo, etc.
        If using a script please wrap with triple backticks and language. EG:
        ` ```javascript `
  - type: textarea # Additional Information
    attributes:
      label: Additional information
      description: >
        If you have any additional information for us that you feel will be valuable, please use the field below.


================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
  - name: Have a formatting issue or feature request?
    url: https://github.com/winstonjs/logform/issues/new/choose
    about: Please search and report @ WinstonJS/Logform
  - name: Need help using Winston?
    url: https://stackoverflow.com/questions/tagged/winston
    about: Please look on StackOverflow first to see if someone has already answered your question.


================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.yml
================================================
name: Would you like to see a feature implemented?
description: Request a new feature for Winston
title: "[Feature Request]: "
labels: ["Feature Request", "Needs Investigation"]
body:
  - type: markdown # Form Header
    attributes:
      value: |
        This issue form is for requesting features only!
  - type: input # Search Terms
    validations:
      required: true
    attributes:
      label: 🔎 Search Terms
      description: >-
        What search terms did you use when trying to find an existing feature request, looking in both open and closed issues?
        List them here (comma seperated) so people in the future can find this one more easily.
  - type: textarea # Feature Definition
    validations:
      required: true
    attributes:
      label: The vision
      description: >-
        Please provide a clear and concise description of the feature you would like to see implemented.
  - type: markdown # Feature Details Section
    attributes:
      value: |
        # Details
  - type: textarea # Use Case Input
    attributes:
      label: Use case
      description: |
        If you desire you can provide use cases for the requested feature.
  - type: textarea # Additional Information
    attributes:
      label: Additional information
      description: >
        If you have any additional information for us that you feel will be valuable, please use the field below.


================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
  - package-ecosystem: github-actions
    directory: /
    schedule:
      interval: weekly
  - package-ecosystem: npm
    directory: /
    schedule:
      interval: weekly


================================================
FILE: .github/workflows/ci.yml
================================================
name: CI Checks

on:
  pull_request:
    branches:
      - main
      - master
  push:
    branches:
      - main
      - master

permissions:
  contents: read #  to fetch code (actions/checkout)

jobs:
  Tests:
    permissions:
      contents: read #  to fetch code (actions/checkout)
      checks: write #  to create new checks (coverallsapp/github-action)

    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        node:
          - 16
          - 18
          - 20
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v6
        with:
          node-version: ${{ matrix.node }}

      - name: Install Dependencies
        run: npm clean-install

      - name: Lint
        run: npm run lint

      - name: Unit Tests (with coverage)
        run: npm run test:unit

      - name: Integration Tests
        run: npm run test:integration

      - name: Report test coverage to Coveralls.io
        if: matrix.node == '20'
        uses: coverallsapp/github-action@master
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

      - name: TypeScript Test
        run: npm run test:typescript


================================================
FILE: .gitignore
================================================
test/*.log
test/fixtures/*.json
test/fixtures/file/*.log*
test/fixtures/logs/*.log*
node_modules/
node_modules/*
npm-debug.log
coverage/
coverage/*
.nyc_output/
.nyc_output/*
*.log
.idea
*.sw*
yarn.lock
*.tgz
dist/


================================================
FILE: .npmignore
================================================
.nyc_output/
coverage/
docs
examples/
scratch/
test/
.*
*.log
*.md
appveyor.yml
tsconfig.json
jest.config.js


================================================
FILE: .prettierrc
================================================
{
  "arrowParens": "avoid",
  "bracketSameLine": false,
  "bracketSpacing": true,
  "embeddedLanguageFormatting": "auto",
  "insertPragma": false,
  "jsxSingleQuote": false,
  "printWidth": 80,
  "proseWrap": "preserve",
  "quoteProps": "as-needed",
  "requirePragma": false,
  "semi": true,
  "singleQuote": true,
  "tabWidth": 2,
  "trailingComma": "none",
  "useTabs": false,
  "endOfLine": "auto"
}


================================================
FILE: CHANGELOG.md
================================================
# CHANGELOG

## [v3.9.0](https://github.com/winstonjs/winston/compare/v3.8.2...v3.9.0)
### Functionality changes
* Handle undefined errors in getAllInfo in exception-handler in https://github.com/winstonjs/winston/pull/2208; thanks to new contributor @eivindrs
* fix: properly allow passing non-array transport in https://github.com/winstonjs/winston/pull/2256; thanks to new contributor @Tanuel
* fix #1732 (Http Transport uses JSON format options as request options) in https://github.com/winstonjs/winston/pull/2272; thanks to new contributor @MoritzLoewenstein (minor version bump per comment on the issue)
* fix: add guard clause to prevent FD leak in https://github.com/winstonjs/winston/pull/2301; thanks to new contributor @td-tomasz-joniec

### Dependency updates by @dependabot + CI autotesting
* Bump eslint from 8.23.0 to 8.32.0 by @dependabot in https://github.com/winstonjs/winston/pull/2209, https://github.com/winstonjs/winston/pull/2236, https://github.com/winstonjs/winston/pull/2258, & https://github.com/winstonjs/winston/pull/2271
* Bump @babel/core from 7.19.0 to 7.20.12 by @dependabot in https://github.com/winstonjs/winston/pull/2206, https://github.com/winstonjs/winston/pull/2234, https://github.com/winstonjs/winston/pull/2259, & https://github.com/winstonjs/winston/pull/2275
* Bump @types/node from 18.0.0 to 18.11.18 by @dependabot in https://github.com/winstonjs/winston/pull/2215, https://github.com/winstonjs/winston/pull/2235, & https://github.com/winstonjs/winston/pull/2264
* Bump @babel/preset-env from 7.19.0 to 7.20.2 by @dependabot in https://github.com/winstonjs/winston/pull/2218 & https://github.com/winstonjs/winston/pull/2244
* Bump safe-stable-stringify from 2.3.1 to 2.4.3 by @dependabot in https://github.com/winstonjs/winston/pull/2217 & https://github.com/winstonjs/winston/pull/2292
* Bump @babel/cli from 7.18.10 to 7.19.3 by @dependabot in https://github.com/winstonjs/winston/pull/2216
* Bump json5 from 2.2.1 to 2.2.3 by @dependabot in https://github.com/winstonjs/winston/pull/2260

### Documentation changes
* Fix readme typo in https://github.com/winstonjs/winston/pull/2230; thanks to new contributor @aretecode
* create new example for ready to use in https://github.com/winstonjs/winston/pull/2240; thanks to new contributor @myagizmaktav
* minor fixes to publishing.md

### Build Infrastructure changes
* GitHub Workflows security hardening in https://github.com/winstonjs/winston/pull/2252; thanks to new contributor @sashashura

## [v3.8.2](https://github.com/winstonjs/winston/compare/v3.8.1...v3.8.2)
### Patch-level changes
* Add `.js` to main entry point in package.json in https://github.com/winstonjs/winston/pull/2177; thanks to new contributor @rumanbsl
* Small grammatical fixes in README.md in https://github.com/winstonjs/winston/pull/2183; thanks to new contributor @mikebarr24
* Move colors to non-dev dependencies by @wbt in https://github.com/winstonjs/winston/pull/2190

### Dependency updates by @dependabot + CI autotesting
* Bump @babel/preset-env from 7.18.2 to 7.19.0 in https://github.com/winstonjs/winston/pull/2189
* Bump @babel/cli from 7.17.10 to 7.18.10 in https://github.com/winstonjs/winston/pull/2173
* Bump eslint from 8.18.0 to 8.23.0 in https://github.com/winstonjs/winston/pull/2184
* Bump @babel/core from 7.18.5 to 7.19.0 in https://github.com/winstonjs/winston/pull/2192
* Bump logform from 2.4.1 to 2.4.2 in https://github.com/winstonjs/winston/pull/2191

## [v3.8.1](https://github.com/winstonjs/winston/compare/v3.8.0...v3.8.1)

### Patch-level changes
* Update types to match in-code definitions in https://github.com/winstonjs/winston/pull/2157; thanks to new contributor @flappyBug

### Dependency updates by @dependabot + CI autotesting
* Bump logform from 2.4.0 to 2.4.1 in https://github.com/winstonjs/winston/pull/2156
* Bump async from 3.2.3 to 3.2.4 in https://github.com/winstonjs/winston/pull/2147
## [v3.8.0](https://github.com/winstonjs/winston/compare/v3.7.2...v3.8.0) / 2022-06-23
### Added functionality
* Add the stringify replacer option to the HTTP transport by @domiins in https://github.com/winstonjs/winston/pull/2155

### Dependency updates by @dependabot + CI autotesting
* Bump @babel/core from 7.17.8 to 7.18.5
* Bump eslint from 8.12.0 to 8.18.0
* Bump @types/node from 17.0.23 to 18.0.0
* Bump @babel/preset-env from 7.16.11 to 7.18.2
* Bump @babel/cli from 7.17.6 to 7.17.10

### Updates facilitating repo maintenance & enhancing documentation
* Explicitly note that the Contributing.md file is out of date
* Add instructions for publishing updated version by @wbt (docs/publishing.md)
* Prettier Config File by @jeanpierrecarvalho in https://github.com/winstonjs/winston/pull/2092
* Readme update to explain origin of errors for handling (#2120)
* update documentation for #2114 by @zizifn in https://github.com/winstonjs/winston/pull/2138
* enhance message for logs with no transports #2114 by @zizifn in https://github.com/winstonjs/winston/pull/2139
* Added a new Community Transport option to the list: Worker Thread based async Console Transport by @arpad1337 in https://github.com/winstonjs/winston/pull/2140

Thanks especially to new contributors @zizifn, @arpad1337, @domiins, & @jeanpierrecarvalho!

## v3.7.2 / 2022-04-04
This change reverts what should have been the feature-level update in 3.7.0 due to issue #2103 showing this to be breaking, unintentionally.

## v3.7.1 / 2022-04-04
This change includes some minor updates to package-lock.json resolving npm audit failures: one in [ansi-regex](https://github.com/advisories/GHSA-93q8-gq69-wqmw) and another in [minimist](https://github.com/advisories/GHSA-xvch-5gv4-984h).

## v3.7.0 / 2022-03-30

Feature-level updates:
- [#1989] Fix: resolve issues with metadata and the associated overriding behavior (thanks @maverick1872, @wbt, @DABH, @fearphage and issue reporters)

Patch-level updates:
- [#2075] Fix: add missing types for batching options for HTTP Transport (thanks @KylinDC)
- Various dependencies updated, quality of life & maintainability changes, etc

## v3.6.0 / 2022-02-12

- [#2057] Fix potential memory leak by not waiting for `process.nextTick` before clearing pending callbacks (thanks @smashah!)
- [#2071] Update to `logform` 2.4.0, which includes changes such as new options for `JsonOptions` and some typo fixes regarding levels
- Various other dependencies are updated, tests are reorganized and cleaned up, etc. (thanks @wbt, @Maverick1872, @fearphage!)

## v3.5.1 / 2022-01-31

This release reverts the changes made in PR #1896 which added stricter typing to the available log levels,
and inadvertently broke use of custom levels with TypeScript (Issue #2047). Apologies for that!

## v3.5.0 / 2022-01-27

This release includes the following, in sequence by first merge in group:

Feature updates:
 -	Support batch mode in HTTP Transport (Issue #1970, PR #1998, thanks @BBE78!)

Patch-level updates:
 -	Bump dependency versions (thanks @dependabot & @DABH!)
    -	Bump @types/node from 16.11.12 to 17.0.8 (PR #2009)
    -	Bump @babel/preset-env from 7.16.7 to 7.16.8 (#2036)
    -	Bump @types/node from 17.0.8 to 17.0.9 (#2035)
    -	Bump @babel/cli from 7.16.7 to 7.16.8 (#2034)
    -	Bump @types/node from 17.0.9 to 17.0.10 (#2042)
    -	Bump @babel/core from 7.16.7 to 7.16.12 (#2041)
    -	Bump @babel/preset-env from 7.16.8 to 7.16.11 (#2040)
 -	Fixing documentation syntax errors in transports code examples (#1916; thanks @romanzaycev!)
 -	Fix missing type declarations, especially for `.rejections`
 (#1842, #1929, #2021; thanks @vanflux, @svaj, @glensc, & others!)
 -	More narrowly typing the “level” string (#1896, thanks @yonas-g!)
 -	Using a safer `stringify`, e.g. to avoid issues from circular structures, in the http transport
 (#2043, thanks @karlwir!)

Updates to the repo & project which don’t actually affect the running code:
 -	Add a channel for reporting security vulnerabilities (#2024, thanks @JamieSlome!)
 -	Add coverage tracking in CI & documentation (#2025 and #2028, thanks @fearphage!)
 -	Update issue templates (#2030 and #2031, thanks @Maverick1872!)
 -	Remove gitter link from README.md (#2027, thanks @DABH!)

Thanks also to maintainers @DABH, @fearphage, @Maverick1872, and @wbt for issue/PR shepherding
and help across multiple parts of the release!
If somebody got missed in the list of thanks, please forgive the accidental oversight
and/or feel free to open a PR on this changelog.

## v3.4.0 / 2022-01-10

Yesterday's release was done with a higher sense of urgency than usual
due to vandalism in the `colors` package.
This release:

 - ties up a loose end by including [#1973] to go with [#1824]
 - adds a missing http property in NpmConfigSetColors [#2004] (thanks @SimDaSong)
 - fixes a minor issue in the build/release process [#2014]
 - pins the version of the testing framework to avoid an issue with a test incorrectly failing [#2017]

The biggest change in this release, motivating the feature-level update, is
[#2006] Make winston more ESM friendly, thanks to @miguelcobain.

Thanks also to @DABH, @wbt, and @fearphage for contributions and reviews!

## v3.3.4 / 2022-01-09

Compared to v3.3.3, this version fixes some issues and includes some updates to project infrastructure,
such as replacing Travis with Github CI and dependabot configuration.
There have also been several relatively minor improvements to documentation, and incorporation of some updated dependencies.
Dependency updates include a critical bug fix [#2008] in response to self-vandalism by the author of a dependency.

- [#1964] Added documentation for how to use a new externally maintained [Seq](https://datalust.co/seq) transport.
- [#1712] Add default metadata when calling log with string level and message.
- [#1824] Unbind event listeners on close
- [#1961] Handle undefined rejections
- [#1878] Correct boolean evaluation of empty-string value for eol option
- [#1977] Improved consistency of object parameters for better test reliability

## v3.3.3 / 2020-06-23

- [#1820] Revert [#1807] to resolve breaking changes for Typescript users.

## v3.3.2 / 2020-06-22

- [#1814] Use a fork of `diagnostics` published to NPM to avoid git dependency.

## v3.3.1 / 2020-06-21

- [#1803], [#1807] Fix TypeScript bugs.
- [#1740] Add space between `info.message` and `meta.message`.
- [#1813] Avoid indirect storage-engine dependency.
- [#1810] README updates.

## v3.3.0 / 2020-06-21

- [#1779] Fix property name in rejection handler.
- [#1768] Exclude extraneous files from NPM package.
- [#1364], [#1714] Don't remove transport from logger when transport error
  occurs.
- [#1603] Expose `child` property on default logger.
- [#1777] Allow HTTP transport to pass options to request.
- [#1662] Add bearer auth capabilities to HTTP transport.
- [#1612] Remove no-op in file transport.
- [#1622], [#1623], [#1625] Typescript fixes.
- (Minor) [#1647], [#1793] Update CI settings.
- (Minor) [#1600], [#1605], [#1593], [#1610], [#1654], [#1656], [#1661],
  [#1651], [#1652], [#1677], [#1683], [#1684], [#1700], [#1697], [#1650],
  [#1705], [#1723], [#1737], [#1733], [#1743], [#1750], [#1754], [#1780],
  [#1778] README, Transports.md, other docs changes.
- [#1672], [#1686], [#1772] Update dependencies.

## v3.2.1 / 2019-01-29
### UNBOUND PROTOTYPE AD INFINITUM EDITION

- #[1579], (@indexzero)  Fallback to the "root" instance **always** created by
  `createLogger` for level convenience methods (e.g. `.info()`, `.silly()`).
  (Fixes [#1577]).
- [#1539], (@indexzero) Assume message is the empty string when level-helper
  methods are invoked with no arguments (Fixed [#1501]).
- [#1583], (@kibertoad) Add typings for defaultMeta (Fixes [#1582])
- [#1586], (@kibertoad) Update dependencies.

## v3.2.0 / 2019-01-26
### SORRY IT TOO SO LONG EDITION

> **NOTE:** this was our first release using Github Projects. See the
> [3.2.0 Release Project](https://github.com/orgs/winstonjs/projects/3).

### New Features!

- [#1471], (@kibertoad) Implement child loggers.
- [#1462], (@drazisil) Add handleRejection support.
  - [#1555], (@DABH) Add fixes from [#1355] to unhandled rejection handler.
- [#1418], (@mfrisbey) Precompile ES6 syntax before publishing to npm.
  - [#1533], (@kibertoad) Update to Babel 7.
- [#1562], (@indexzero) [fix] Better handling of `new Error(string)`
  throughout the pipeline(s). (Fixes [#1338], [#1486]).

### Bug Fixes

- [#1355], (@DABH) Fix issues with ExceptionHandler (Fixes [#1289]).
- [#1463], (@SerayaEryn) Bubble transport `warn` events up to logger in
  addition to `error`s.
- [#1480], [#1503], (@SerayaEryn) File tailrolling fix.
- [#1483], (@soldair) Assign log levels to un-bound functions.
- [#1513], (@TilaTheHun0) Set maxListeners for Console transport.
- [#1521], (@jamesbechet) Fix Transform from `readable-stream` using CRA.
- [#1434], (@Kouzukii) Fixes logger.query function (regression from `3.0.0`)
- [#1526], (@pixtron) Log file without .gz for tailable (Fixes [#1525]).
- [#1559], (@eubnara) Fix typo related to `exitOnError`.
- [#1556], (@adoyle-h) Support to create log directory if it doesn't exist
  for FileTransport.

#### New `splat` behavior

- [#1552], (@indexzero) Consistent handling of meta with (and without)
  interpolation in `winston` and `logform`.
- [#1499], (@DABH) Provide all of `SPLAT` to formats (Fixes [#1485]).
- [#1485], (@mpabst) Fixing off-by-one when using both meta and splat.

Previously `splat` would have added a `meta` property for any additional
`info[SPLAT]` beyond the expected number of tokens.

**As of `logform@2.0.0`,** `format.splat` assumes additional splat paramters
(aka "metas") are objects and merges enumerable properties into the `info`.
e.g. **BE ADVISED** previous "metas" that _were not objects_ will very likely
lead to odd behavior. e.g.

``` js
const { createLogger, format, transports } = require('winston');
const { splat } = format;
const { MESSAGE, LEVEL, SPLAT } = require('triple-beam');

const logger = createLogger({
  format: format.combine(
    format.splat(),
    format.json()
  ),
  transports: [new transports.Console()]
});

// Expects two tokens, but four splat parameters provided.
logger.info(
  'Let us %s for %j',   // message
  'objects',           // used for %s
  { label: 'sure' },   // used for %j
  'lol', ['ok', 'why'] // Multiple additional meta values
);

// winston < 3.2.0 && logform@1.x behavior:
// Added "meta" property.
//
// { level: 'info',
//   message: 'Let us objects for {"label":"sure"}',
//   meta: ['lol', ['ok', 'why']],
//   [Symbol(level)]: 'info',
//   [Symbol(message)]: 'Let us %s for %j',
//   [Symbol(splat)]: [ 'objects', { label: 'sure' } ] }

// winston >= 3.2.0 && logform@2.x behavior: Enumerable properties
// assigned into `info`. Since **strings and Arrays only have NUMERIC
// enumerable properties we get this behavior!**
//
// { '0': 'ok',
//   '1': 'why',
//   '2': 'l',
//   level: 'info',
//   message: 'Let us objects for {"label":"sure"}',
//   [Symbol(level)]: 'info',
//   [Symbol(message)]: 'Let us %s for %j',
//   [Symbol(splat)]: [ 'objects', { label: 'sure' } ] }
```

## Maintenance & Documentation

- Documentation Updates
  - [#1410], (@hakanostrom) Add docs reference to transport for Cloudant.
  - [#1467], (@SeryaEryn) Add fast-file-rotate transport to transport.md.
  - [#1488], (@adamcohen) Fix multi logger documentation.
  - [#1531], (@mapleeit) Add links to transports.
  - [#1548], (@ejmartin504) Fix `README.md` for awaiting logs.
  - [#1554], (@indexzero) Document the solution to [#1486] as by design.
  - Other small improvements: [#1509].
- Improved TypeScript support
  - [#1470], (@jd-carroll) Export all transport options (Fixes [#1469]).
  - [#1474], (@jd-carroll) Correct import to avoid conflict (Fixed [#1472]).
  - [#1546], (@alewiahmed) Add consoleWarnLevels field to the
    `ConsoleTransportOptions` interface type definition.
  - [#1557], (@negezor) Add missing `child()` method.
- Dependency management
  - [#1560], (@kibertoad) Update dependencies.
  - [#1512], (@SerayaEryn) Add node@11 and disallow failures on node@10.
  - [#1516], (@SerayaEryn) Update `readable-stream` to `v3.0.6`.
  - [#1534], (@kibertoad) Update `@types/node`, `nyc`, and `through2`.

## v3.1.0 / 2018-08-22
### RELEASES ON A PLANE EDITION

- Minor TypeScript fixes [#1362], [#1395], [#1440]
- Fix minor typos [#1359], [#1363], [#1372], [#1378], [#1390]
- [#1373], (@revik): Add `consoleWarnLevels` property to console transport options for `console.warn` browser support.
- [#1394], (@bzoz): Fix tests on Windows.
- [#1447], (@dboshardy): Support transport name option to override default names for built-in transports.
- [#1420], (@ledbit): Fix file rotation with `tailing: true` (Fixes [#1450], [#1194]).
- [#1352], (@lutovich): Add `isLevelEnabled(string)` & `isXXXEnabled()` to `Logger` class.
- Dependency management
  - Regenerate `package-lock.json`.
  - Upgrade to `colors@^1.3.2` (Fixes [#1439]).
  - Upgrade to `logform@^1.9.1`.
  - Upgrade to `diagnostics@^1.1.1`.
  - Upgrade to `@types/node@^10.9.3`.
  - Upgrade to `assume@^2.1.0`.
  - Upgrade to `hock@^1.3.3`.
  - Upgrade to `mocha@^5.2.0`.
  - Upgrade to `nyc@^13.0.1`.
  - Upgrade to `split2@^3.0.0`.

## v3.0.0 / 2018-06-12
### GET IN THE CHOPPA EDITION

- [#1332], (@DABH): logger.debug is sent to stderr (Fixed [#1024])
- [#1328], (@ChrisAlderson): Logger level doesn't update transports level (Fixes [#1191]).
- [#1356], (@indexzero) Move splat functionality into logform. (Fixes [#1298]).
- [#1340], (@indexzero): Check log.length when evaluating "legacyness" of transports (Fixes [#1280]).
- [#1346], (@indexzero): Implement `_final` from Node.js streams. (Related to winston-transport#24, Fixes [#1250]).
- [#1347], (@indexzero): Wrap calls to `format.transform` with try / catch (Fixes [#1261]).
- [#1357], (@indexzero): Remove paddings as we have no use for it in the current API.
- [TODO]: REMAINS OPEN, NO PR (Fixes [#1289])
- Documentation
  - [#1301], (@westonpace) Cleaned up some of the documentation on `colorize`
    to address concerns in [#1095].
  - First pass at a heavy refactor of `docs/transports.md`.
- Dependency management
  - Regenerate `package-lock.json`.
  - Upgrade to `logform@^1.9.0`.

## v3.0.0-rc6 / 2018-05-30
### T-MINUS 6-DAY TO WINSTON@3 EDITION

- **Document that we are pushing for a June 5th, 2018 release of `winston@3.0.0`**
- [#1287], (@DABH) Added types for Typescript.
  - [#1335] Typescript: silent is boolean.
  - [#1323] Add level method to default logger.
- [#1286], (@ChrisAlderson) Migrate codebase to ES6
  - [#1324], (@ChrisAlderson) Fix regression introduced by ES6 migration for
    exception handling.
  - [#1333], (@ChrisAlderson) Fix removing all loggers from a container.
- [#1291], [#1294], [#1318], (@indexzero, @ChrisAlderson, @mempf) Improvements
  to `File` transport core functionality. Fixes [#1194].
- [#1311], (@ChrisAlderson) Add `eol` option to `Stream` transport.
- [#1297], (@ChrisAlderson) Move `winston.config` to `triple-beam`. Expose
  for backwards compatibility.
- [#1320], (@ChrisAlderson) Enhance tests to run on Windows.
- Internal project maintenance
  - Bump to `winston-transport@4.0.0` which may cause incompatibilities if
    your custom transport does not explicitly require `winston-transport`
    itself.
  - [#1292], (@ChrisAlderson) Add node v10 to TravisCI build matrix.
  - [#1296], (@indexzero) Improve `UPGRADE-3.0.md`. Add Github Issue Template.
  - Remove "npm run report" in favor of reports being automatically generate.
  - Update `logform`, `triple-beam`, and `winston-transport` to latest.

> Special thanks to our newest `winston` core team member – @ChrisAlderson for
> helping make `winston@3.0.0` a reality next week!

## v3.0.0-rc5 / 2018-04-20
### UNOFFICIAL NATIONAL HOLIDAY EDITION

- [#1281] Use `Buffer.alloc` and `Buffer.from` instead of `new Buffer`.
- Better browser support
  - [#1142] Move common tailFile to a separate file
  - [#1279] Use feature detection to be safer for browser usage.
- MOAR Docs!
  - **Document that we are pushing for a May 29th, 2018 release of `winston@3.0.0`**
  - **Add David Hyde as official contributor.**
  - [#1278] Final Draft of Upgrade Guide in `UPGRADE-3.0.md`
  - Merge Roadmap from `3.0.0.md` into `CONTRIBUTING.md` and other
    improvements to `CONTRIBUTING.md`
- Improve & expand examples
  - [#1175] Add more copy about printf formats based on issue feedback.
  - [#1134] Add sampleto document timestamps more clearly as an example.
  - [#1273] Add example using multiple formats.
  - [#1250] Add an example illustrating the "finish" event for AWS Lambda scenarios.
  - Use simple format to better show that `humanReadableUnhandledException` is now the default message format.
  - Add example to illustrate that example code from winston-transport
    `README.md` is correct.
- Update `devDependencies`
  - Bump `assume` to `^2.0.1`.
  - Bump `winston-compat` to `^0.1.1`.

## v3.0.0-rc4 / 2018-04-06
### IF A TREE FALLS IN THE FORREST DOES IT MAKE A LOG EDITION

- (@indexzero, @dabh) Add support for `{ silent }` option to
``` js
require('winston').Logger;
require('winston-transport').TransportStream;
```
- Better browser support
  - [#1145], (@Jasu) Replace `isstream` with `is-stream` to make stream detection work in browser.
  - [#1146], (@Jasu) Rename query to different than function name, to support Babel 6.26.
- Better Typescript support in all supporting libraries
  - `logform@1.4.1`
- Update documentation
  - (@indexzero) Correct link to upgrade guide. Fixes #1255.
  - [#1258], (@morenoh149) Document how to colorize levels. Fixes #1135.
  - [#1246], (@KlemenPlazar) Update colors argument when adding custom colors
  - Update `CONTRIBUTING.md`
  - [#1239], (@dabh) Add changelog entries for `v3.0.0-rc3`
  - Add example showing that `{ level }` can be deleted from info objects because `Symbol.for('level')` is what `winston` uses internally. Fixes #1184.

## v3.0.0-rc3 / 2018-03-16
### I GOT NOTHING EDITION

- [#1195], (@Nilegfx) Fix type error when creating `new stream.Stream()`
- [#1109], (@vsetka) Fix file transprot bug where `self.filename` was not being updated on `ENOENT`
- [#1153], (@wizardnet972) Make prototype methods return like the original method
- [#1234], (@guiguan, @indexzero) Add tests for properly handling logging of `undefined`, `null` and `Error` values
- [#1235], (@indexzero) Add example demonstrating how `meta` objects BECOME the `info` object
- Minor fixes to docs & examples: [#1232], [#1185]

## v3.0.0-rc2 / 2018-03-09
### MAINTENANCE RESUMES EDITION

- [#1209], (@dabh) Use new version of colors, solving a number of issues.
- [#1197], (@indexzero) Roadmap & guidelines for contributors.
- [#1100] Require the package.json by its full name.
- [#1149] Updates `async` to latest (`2.6.0`)
- [#1228], (@mcollina) Always pass a function to `fs.close`.
- Minor fixes to docs & examples: [#1177], [#1182], [#1208], [#1198], [#1165], [#1110], [#1117], [#1097], [#1155], [#1084], [#1141], [#1210], [#1223].

## v3.0.0-rc1 / 2017-10-19
### OMG THEY FORGOT TO NAME IT EDITION

 - Fix file transport improper binding of `_onDrain` and `_onError` [#1104](https://github.com/winstonjs/winston/pull/1104)

## v3.0.0-rc0 / 2017-10-02
### IT'S-DONE.GIF EDITION

**See [UPGRADE-3.0.md](UPGRADE-3.0.md) for a complete & living upgrade guide.**

**See [3.0.0.md](3.0.0.md) for a list of remaining RC tasks.**

- **Rewrite of core logging internals:** `Logger` & `Transport` are now implemented using Node.js `objectMode` streams.
- **Your transports _should_ not break:** Special attention has been given to ensure backwards compatibility with existing transports. You will likely see this:
```
YourTransport is a legacy winston transport. Consider upgrading to winston@3:
- Upgrade docs: https://github.com/winstonjs/winston/tree/master/UPGRADE.md
```
- **`filters`, `rewriters`, and `common.log` are now _formats_:** `winston.format` offers a simple mechanism for user-land formatting & style features. The organic & frankly messy growth of `common.log` is of the past; these feature requests can be implemented entirely outside of `winston` itself.
``` js
const { createLogger, format, transports } = require('winston');
const { combine, timestamp, label, printf } = format;

const myFormat = printf(info => {
  return `${info.timestamp} [${info.label}] ${info.level}: ${info.message}`;
});

const logger = createLogger({
  combine(
    label({ label: 'right meow!' }),
    timestamp(),
    myFormat
  ),
  transports: [new transports.Console()]
});
```
- **Increased modularity:** several subsystems are now stand-alone packages:
  - [logform] exposed as `winston.format`
  - [winston-transport] exposed as `winston.Transport`
  - [abstract-winston-transport] used for reusable unit test suites for transport authors.
- **`2.x` branch will get little to no maintenance:** no feature requests will be accepted – only a limited number of open PRs will be merged. Hoping the [significant performance benefits][perf-bench] incentivizes folks to upgrade quickly. Don't agree? Say something!
- **No guaranteed support for `node@4` or below:** all code will be migrated to ES6 over time. This release was started when ES5 was still a hard requirement due to the current LTS needs.

## v2.4.0 / 2017-10-01
### ZOMFG WINSTON@3.0.0-RC0 EDITION

- [#1036] Container.add() 'filters' and 'rewriters' option passing to logger.
- [#1066] Fixed working of "humanReadableUnhandledException" parameter when additional data is added in meta.
- [#1040] Added filtering by log level
- [#1042] Fix regressions brought by `2.3.1`.
  - Fix regression on array printing.
  - Fix regression on falsy value.
- [#977] Always decycle objects before cloning.
  - Fixes [#862]
  - Fixes [#474]
  - Fixes [#914]
- [57af38a] Missing context in `.lazyDrain` of `File` transport.
- [178935f] Suppress excessive Node warning from `fs.unlink`.
- [fcf04e1] Add `label` option to `File` transport docs.
- [7e736b4], [24300e2] Added more info about undocumented `winston.startTimer()` method.
- [#1076], [#1082], [#1029], [#989], [e1e7188] Minor grammatical & style updates to `README.md`.

## v2.3.1 / 2017-01-20
### WELCOME TO THE APOCALYPSE EDITION

- [#868](https://github.com/winstonjs/winston/pull/868), Fix 'Maximum call stack size exceeded' error with custom formatter.

## v2.3.0 / 2016-11-02
### ZOMG WHY WOULD YOU ASK EDITION

- Full `CHANGELOG.md` entry forthcoming. See [the `git` diff for `2.3.0`](https://github.com/winstonjs/winston/compare/2.2.0...2.3.0) for now.

## v2.2.0 / 2016-02-25
### LEAVING CALIFORNIA EDITION

- Full `CHANGELOG.md` entry forthcoming. See [the `git` diff for `2.2.0`](https://github.com/winstonjs/winston/compare/2.1.1...2.2.0) for now.

## v2.1.1 / 2015-11-18
### COLOR ME IMPRESSED EDITION

- [#751](https://github.com/winstonjs/winston/pull/751), Fix colors not appearing in non-tty environments. Fixes [#609](https://github.com/winstonjs/winston/issues/609), [#616](https://github.com/winstonjs/winston/issues/616), [#669](https://github.com/winstonjs/winston/issues/669), [#648](https://github.com/winstonjs/winston/issues/648) (`fiznool`).
- [#752](https://github.com/winstonjs/winston/pull/752)     Correct syslog RFC number. 5424 instead of 524. (`jbenoit2011`)

## v2.1.0 / 2015-11-03
### TEST ALL THE ECOSYSTEM EDITION

- [#742](https://github.com/winstonjs/winston/pull/742), [32d52b7](https://github.com/winstonjs/winston/commit/32d52b7) Distribute common test files used by transports in the `winston` ecosystem.

## v2.0.1 / 2015-11-02
### BUGS ALWAYS HAPPEN OK EDITION

- [#739](https://github.com/winstonjs/winston/issues/739), [1f16861](https://github.com/winstonjs/winston/commit/1f16861) Ensure that `logger.log("info", undefined)` does not throw.

## v2.0.0 / 2015-10-29
### OMG IT'S MY SISTER'S BIRTHDAY EDITION

#### Breaking changes

**Most important**
- **[0f82204](https://github.com/winstonjs/winston/commit/0f82204) Move `winston.transports.DailyRotateFile` [into a separate module](https://github.com/winstonjs/winston-daily-rotate-file)**: `require('winston-daily-rotate-file');`
- **[fb9eec0](https://github.com/winstonjs/winston/commit/fb9eec0) Reverse log levels in `npm` and `cli` configs to conform to [RFC524](https://tools.ietf.org/html/rfc5424). Fixes [#424](https://github.com/winstonjs/winston/pull/424) [#406](https://github.com/winstonjs/winston/pull/406) [#290](https://github.com/winstonjs/winston/pull/290)**
- **[8cd8368](https://github.com/winstonjs/winston/commit/8cd8368) Change the method signature to a `filter` function to be consistent with `rewriter` and log functions:**
``` js
function filter (level, msg, meta, inst) {
  // Filter logic goes here...
}
```

**Other breaking changes**
- [e0c9dde](https://github.com/winstonjs/winston/commit/e0c9dde) Remove `winston.transports.Webhook`. Use `winston.transports.Http` instead.
- [f71e638](https://github.com/winstonjs/winston/commit/f71e638) Remove `Logger.prototype.addRewriter` and `Logger.prototype.addFilter` since they just push to an Array of functions. Use `logger.filters.push` or `logger.rewriters.push` explicitly instead.
- [a470ab5](https://github.com/winstonjs/winston/commit/a470ab5) No longer respect the `handleExceptions` option to `new winston.Logger`. Instead just pass in the `exceptionHandlers` option itself.
- [8cb7048](https://github.com/winstonjs/winston/commit/8cb7048) Removed `Logger.prototype.extend` functionality

#### New features
- [3aa990c](https://github.com/winstonjs/winston/commit/3aa990c) Added `Logger.prototype.configure` which now contains all logic previously in the `winston.Logger` constructor function. (`indexzero`)
- [#726](https://github.com/winstonjs/winston/pull/726) Update .npmignore (`coreybutler`)
- [#700](https://github.com/winstonjs/winston/pull/700) Add an `eol` option to the `Console` transport. (`aquavitae`)
- [#731](https://github.com/winstonjs/winston/pull/731) Update `lib/transports.js` for better static analysis. (`indexzero`)

#### Fixes, refactoring, and optimizations. OH MY!
- [#632](https://github.com/winstonjs/winston/pull/632) Allow `File` transport to be an `objectMode` writable stream. (`stambata`)
- [#527](https://github.com/winstonjs/winston/issues/527), [163f4f9](https://github.com/winstonjs/winston/commit/163f4f9), [3747ccf](https://github.com/winstonjs/winston/commit/3747ccf) Performance optimizations and string interpolation edge cases (`indexzero`)
- [f0edafd](https://github.com/winstonjs/winston/commit/f0edafd) Code cleanup for reability, ad-hoc styleguide enforcement (`indexzero`)

## v1.1.1 - v1.1.2 / 2015-10
### MINOR FIXES EDITION

#### Notable changes
  * [727](https://github.com/winstonjs/winston/pull/727) Fix "raw" mode (`jcrugzz`)
  * [703](https://github.com/winstonjs/winston/pull/703) Do not modify Error or Date objects when logging. Fixes #610 (`harriha`).

## v1.1.0 / 2015-10-09
### GREETINGS FROM CARTAGENA EDITION

#### Notable Changes
  * [#721](https://github.com/winstonjs/winston/pull/721) Fixed octal literal to work with node 4 strict mode (`wesleyeff`)
  * [#630](https://github.com/winstonjs/winston/pull/630) Add stderrLevels option to Console Transport and update docs (`paulhroth`)
  * [#626](https://github.com/winstonjs/winston/pull/626) Add the logger (this) in the fourth argument in the rewriters and filters functions (`christophehurpeau `)
  * [#623](https://github.com/winstonjs/winston/pull/623) Fix Console Transport's align option tests (`paulhroth`, `kikobeats`)
  * [#692](https://github.com/winstonjs/winston/pull/692) Adding winston-aws-cloudwatch to transport docs (`timdp`)

## v1.0.2 2015-09-25
### LET'S TALK ON GITTER EDITION

#### Notable Changes
  * [de80160](https://github.com/winstonjs/winston/commit/de80160) Add Gitter badge (`The Gitter Badger`)
  * [44564de](https://github.com/winstonjs/winston/commit/44564de) [fix] Correct listeners in `logException`. Fixes [#218](https://github.com/winstonjs/winston/issues/218) [#213](https://github.com/winstonjs/winston/issues/213) [#327](https://github.com/winstonjs/winston/issues/327). (`indexzero`)
  * [45b1eeb](https://github.com/winstonjs/winston/commit/45b1eeb) [fix] Get `tailFile` function working on latest/all node versions (`Christopher Jeffrey`)
  * [c6d45f9](https://github.com/winstonjs/winston/commit/c6d45f9) Fixed event subscription on close (`Roman Stetsyshin`)

#### Other changes
  * TravisCI updates & best practices [87b97cc](https://github.com/winstonjs/winston/commit/87b97cc) [91a5bc4](https://github.com/winstonjs/winston/commit/91a5bc4), [cf24e6a](https://github.com/winstonjs/winston/commit/cf24e6a) (`indexzero`)
  * [d5397e7](https://github.com/winstonjs/winston/commit/d5397e7) Bump async version (`Roderick Hsiao`)
  * Documentation updates & fixes [86d7527](https://github.com/winstonjs/winston/commit/86d7527), [38254c1](https://github.com/winstonjs/winston/commit/38254c1), [04e2928](https://github.com/winstonjs/winston/commit/04e2928), [61c8a89](https://github.com/winstonjs/winston/commit/61c8a89), [c42a783](https://github.com/winstonjs/winston/commit/c42a783), [0688a22](https://github.com/winstonjs/winston/commit/0688a22), [eabc113](https://github.com/winstonjs/winston/commit/eabc113) [c9506b7](https://github.com/winstonjs/winston/commit/c9506b7), [17534d2](https://github.com/winstonjs/winston/commit/17534d2), [b575e7b](https://github.com/winstonjs/winston/commit/b575e7b) (`Stefan Thies`, `charukiewicz`, `unLucio`, `Adam Cohen`, `Denis Gorbachev`, `Frederik Ring`, `Luigi Pinca`, `jeffreypriebe`)
  * Documentation refactor & cleanup [a19607e](https://github.com/winstonjs/winston/commit/a19607e), [d1932b4](https://github.com/winstonjs/winston/commit/d1932b4), [7a13132](https://github.com/winstonjs/winston/commit/7a13132) (`indexzero`)


## v1.0.1 / 2015-06-26
### YAY DOCS EDITION

  * [#639](https://github.com/winstonjs/winston/pull/639) Fix for [#213](https://github.com/winstonjs/winston/issues/213): More than 10 containers triggers EventEmitter memory leak warning (`marcus`)
  * Documentation and `package.json` updates [cec892c](https://github.com/winstonjs/winston/commit/cec892c), [2f13b4f](https://github.com/winstonjs/winston/commit/2f13b4f), [b246efd](https://github.com/winstonjs/winston/commit/b246efd), [22a5f5a](https://github.com/winstonjs/winston/commit/22a5f5a), [5868b78](https://github.com/winstonjs/winston/commit/5868b78), [99b6b44](https://github.com/winstonjs/winston/commit/99b6b44), [447a813](https://github.com/winstonjs/winston/commit/447a813), [7f75b48](https://github.com/winstonjs/winston/commit/7f75b48) (`peteward44`, `Gilad Peleg`, `Anton Ian Sipos`, `nimrod-becker`, `LarsTi`, `indexzero`)

## v1.0.0 / 2015-04-07
### OMG 1.0.0 FINALLY EDITION

#### Breaking Changes
  * [#587](https://github.com/winstonjs/winston/pull/587) Do not extend `String` prototypes as a side effect of using `colors`. (`kenperkins`)
  * [#581](https://github.com/winstonjs/winston/pull/581) File transports now emit `error` on error of the underlying streams after `maxRetries` attempts. (`ambbell`).
  * [#583](https://github.com/winstonjs/winston/pull/583), [92729a](https://github.com/winstonjs/winston/commit/92729a68d71d07715501c35d94d2ac06ac03ca08) Use `os.EOL` for all file writing by default. (`Mik13`, `indexzero`)
  * [#532](https://github.com/winstonjs/winston/pull/532) Delete logger instance from `Container` when `close` event is emitted. (`snater`)
  * [#380](https://github.com/winstonjs/winston/pull/380) Rename `duration` to `durationMs`, which is now a number a not a string ending in `ms`. (`neoziro`)
  * [#253](https://github.com/winstonjs/winston/pull/253) Do not set a default level. When `level` is falsey on any `Transport` instance, any `Logger` instance uses the configured level (instead of the Transport level) (`jstamerj`).

#### Other changes

  * [b83de62](https://github.com/winstonjs/winston/commit/b83de62) Fix rendering of stack traces.
  * [c899cc](https://github.com/winstonjs/winston/commit/c899cc1f0719e49b26ec933e0fa263578168ea3b) Update documentation (Fixes [#549](https://github.com/winstonjs/winston/issues/549))
  * [#551](https://github.com/winstonjs/winston/pull/551) Filter metadata along with messages
  * [#578](https://github.com/winstonjs/winston/pull/578) Fixes minor issue with `maxFiles` in `File` transport (Fixes [#556](https://github.com/winstonjs/winston/issues/556)).
  * [#560](https://github.com/winstonjs/winston/pull/560) Added `showLevel` support to `File` transport.
  * [#558](https://github.com/winstonjs/winston/pull/558) Added `showLevel` support to `Console` transport.

## v0.9.0 / 2015-02-03

  * [#496](https://github.com/flatiron/winston/pull/496) Updated default option handling for CLI (`oojacoboo`).
  * [f37634b](https://github.com/flatiron/winston/commit/f37634b) [dist] Only support `node >= 0.8.0`. (`indexzero`)
  * [91a1e90](https://github.com/flatiron/winston/commit/91a1e90), [50163a0](https://github.com/flatiron/winston/commit/50163a0) Fix #84 [Enable a better unhandled exception experience](https://github.com/flatiron/winston/issues/84) (`samz`)
  * [8b5fbcd](https://github.com/flatiron/winston/commit/8b5fbcd) #448 Added tailable option to file transport which rolls files backwards instead of creating incrementing appends. Implements #268 (`neouser99`)
  * [a34f7d2](https://github.com/flatiron/winston/commit/a34f7d2) Custom log formatter functionality were added. (`Melnyk Andii`)
  * [4c08191](https://github.com/flatiron/winston/commit/4c08191) Added showLevel flag to common.js, file*, memory and console transports. (`Tony Germaneri`)
  * [64ed8e0](https://github.com/flatiron/winston/commit/64ed8e0) Adding custom pretty print function test. (`Alberto Pose`)
  * [3872dfb](https://github.com/flatiron/winston/commit/3872dfb) Adding prettyPrint parameter as function example. (`Alberto Pose`)
  * [2b96eee](https://github.com/flatiron/winston/commit/2b96eee) implemented filters #526 (`Chris Oloff`)
  * [72273b1](https://github.com/flatiron/winston/commit/72273b1) Added the options to colorize only the level, only the message or all. Default behavior is kept. Using true will only colorize the level and false will not colorize anything. (`Michiel De Mey`)
  * [178e8a6](https://github.com/flatiron/winston/commit/178e8a6) Prevent message from meta input being overwritten (`Leonard Martin`)
  * [270be86](https://github.com/flatiron/winston/commit/270be86) [api] Allow for transports to be removed by their string name [test fix] Add test coverage for multiple transports of the same type added in #187. [doc] Document using multiple transports of the same type (`indexzero`)
  * [0a848fa](https://github.com/flatiron/winston/commit/0a848fa) Add depth options for meta pretty print (`Loïc Mahieu`)
  * [106b670](https://github.com/flatiron/winston/commit/106b670) Allow debug messages to be sent to stdout (`John Frizelle`)
  * [ad2d5e1](https://github.com/flatiron/winston/commit/ad2d5e1) [fix] Handle Error instances in a sane way since their properties are non-enumerable __by default.__ Fixes #280. (`indexzero`)
  * [5109dd0](https://github.com/flatiron/winston/commit/5109dd0) [fix] Have a default `until` before a default `from`. Fixes #478. (`indexzero`)
  * [d761960](https://github.com/flatiron/winston/commit/d761960) Fix logging regular expression objects (`Chasen Le Hara`)
  * [2632eb8](https://github.com/flatiron/winston/commit/2632eb8) Add option for EOL chars on FileTransport (`José F. Romaniello`)
  * [bdecce7](https://github.com/flatiron/winston/commit/bdecce7) Remove duplicate logstash option (`José F. Romaniello`)
  * [7a01f9a](https://github.com/flatiron/winston/commit/7a01f9a) Update declaration block according to project's style guide (`Ricardo Torres`)
  * [ae27a19](https://github.com/flatiron/winston/commit/ae27a19) Fixes #306: Can't set customlevels to my loggers (RangeError: Maximum call stack size exceeded) (`Alberto Pose`)
  * [1ba4f51](https://github.com/flatiron/winston/commit/1ba4f51) [fix] Call `res.resume()` in HttpTransport to get around known issues in streams2. (`indexzero`)
  * [39e0258](https://github.com/flatiron/winston/commit/39e0258) Updated default option handling for CLI (`Jacob Thomason`)
  * [8252801](https://github.com/flatiron/winston/commit/8252801) Added logstash support to console transport (`Ramon Snir`)
  * [18aa301](https://github.com/flatiron/winston/commit/18aa301) Module isStream should be isstream (`Michael Neil`)
  * [2f5f296](https://github.com/flatiron/winston/commit/2f5f296) options.prettyPrint can now be a function (`Matt Zukowski`)
  * [a87a876](https://github.com/flatiron/winston/commit/a87a876) Adding rotationFormat prop to file.js (`orcaman`)
  * [ff187f4](https://github.com/flatiron/winston/commit/ff187f4) Allow custom exception level (`jupiter`)

## 0.8.3 / 2014-11-04

* [fix lowercase issue (`jcrugzz`)](https://github.com/flatiron/winston/commit/b3ffaa10b5fe9d2a510af5348cf4fb3870534123)

## 0.8.2 / 2014-11-04

* [Full fix for #296 with proper streams2 detection with `isstream` for file transport (`jcrugzz`)](https://github.com/flatiron/winston/commit/5c4bd4191468570e46805ed399cad63cfb1856cc)
* [Add isstream module (`jcrugzz`)](https://github.com/flatiron/winston/commit/498b216d0199aebaef72ee4d8659a00fb737b9ae)
* [Partially fix #296 with streams2 detection for file transport (`indexzero`)](https://github.com/flatiron/winston/commit/b0227b6c27cf651ffa8b8192ef79ab24296362e3)
* [add stress test for issue #288 (`indexzero`)](https://github.com/flatiron/winston/commit/e08e504b5b3a00f0acaade75c5ba69e6439c84a6)
* [lessen timeouts to check test sanity (`indexzero`)](https://github.com/flatiron/winston/commit/e925f5bc398a88464f3e796545ff88912aff7568)
* [update winston-graylog2 documentation (`unlucio`)](https://github.com/flatiron/winston/commit/49fa86c31baf12c8ac3adced3bdba6deeea2e363)
* [fix test formatting (`indexzero`)](https://github.com/flatiron/winston/commit/8e2225799520a4598044cdf93006d216812a27f9)
* [fix so options are not redefined (`indexzero`)](https://github.com/flatiron/winston/commit/d1d146e8a5bb73dcb01579ad433f6d4f70b668ea)
* [fix self/this issue that broke `http` transport (`indexzero`)](https://github.com/flatiron/winston/commit/d10cbc07755c853b60729ab0cd14aa665da2a63b)


## 0.8.1 / 2014-10-06

* [Add label option for DailyRotateFile transport (`francoisTemasys`)](https://github.com/flatiron/winston/pull/459)
* [fix Logger#transports length check upon Logger#log (`adriano-di-giovanni`, `indexzero`)](https://github.com/flatiron/winston/pull/404)
* [err can be a string. (`gdw2`, `indexzero`)](https://github.com/flatiron/winston/pull/396)
* [Added color for pre-defined cli set. (`danilo1105`, `indexzero`)](https://github.com/flatiron/winston/pull/365)
* [Fix dates on transport test (`revington`)](https://github.com/flatiron/winston/pull/346)
* [Included the label from options to the output in JSON mode. (`arxony`)](https://github.com/flatiron/winston/pull/326)
* [Allow using logstash option with the File transport (`gmajoulet`)](https://github.com/flatiron/winston/pull/299)
* [Be more defensive when working with `query` methods from Transports. Fixes #356. (indexzero)](https://github.com/flatiron/winston/commit/b80638974057f74b521dbe6f43fef2105110afa2)
* [Catch exceptions for file transport unlinkSync (`calvinfo`)](https://github.com/flatiron/winston/pull/266)
* [Adding the 'addRewriter' to winston (`machadogj`)](https://github.com/flatiron/winston/pull/258)
* [Updates to transport documentation (`pose`)](https://github.com/flatiron/winston/pull/262)
* [fix typo in "Extending another object with Logging" section.](https://github.com/flatiron/winston/pull/281)
* [Updated README.md - Replaced properties with those listed in winston-mongodb module](https://github.com/flatiron/winston/pull/264)

## 0.8.0 / 2014-09-15
  * [Fixes for HTTP Transport](https://github.com/flatiron/winston/commit/a876a012641f8eba1a976eada15b6687d4a03f82)
  * Removing [jsonquest](https://github.com/flatiron/winston/commit/4f088382aeda28012b7a0498829ceb243ed74ac1) and [request](https://github.com/flatiron/winston/commit/a5676313b4e9744802cc3b8e1468e4af48830876) dependencies.
  * Configuration is now [shalow cloned](https://github.com/flatiron/winston/commit/08fccc81d18536d33050496102d98bde648853f2).
  * [Added logstash support](https://github.com/flatiron/winston/pull/445/files)
  * Fix for ["flush" event should always fire after "flush" call bug](https://github.com/flatiron/winston/pull/446/files)
  * Added tests for file: [open and stress](https://github.com/flatiron/winston/commit/47d885797a2dd0d3cd879305ca813a0bd951c378).
  * [Test fixes](https://github.com/flatiron/winston/commit/9e39150e0018f43d198ca4c160acef2af9860bf4)
  * [Fix ")" on string interpolation](https://github.com/flatiron/winston/pull/394/files)

## 0.6.2 / 2012-07-08

  * Added prettyPrint option for console logging
  * Multi-line values for conditional returns are not allowed
  * Added acceptance of `stringify` option
  * Fixed padding for log levels


================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
education, socio-economic status, nationality, personal appearance, race,
religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
  advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
  address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
  professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at charlie.robbins@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org



================================================
FILE: CONTRIBUTING.md
================================================
# CONTRIBUTING
PLEASE NOTE: This document has not been updated in a while and is out of date, but contents are retained as some may still be useful.

TL;DR? The `winston` project recently shipped `3.0.0` out of RC and is actively
working towards the next feature release as it continues to triage issues. 

- [Be kind & actively empathetic to one another](CODE_OF_CONDUCT.md)
- [What makes up `winston`?](#what-makes-up-winston)
- [What about `winston@2.x`?!](#what-about-winston-2.x)
- [Could this be implemented as a format?](#could-this-be-implemented-as-a-format)
- [Roadmap](#roadmap)

Looking for somewhere to help? Checkout the [Roadmap](#roadmap) & help triage open issues! Find an issue that looks like a duplicate? It probably is! Comment on it so we know it's maybe a duplicate 🙏.

## What makes up `winston`?

As of `winston@3` the project has been broken out into a few modules:

- [winston-transport]: `Transport` stream implementation & legacy `Transport` wrapper.
- [logform]: All formats exports through `winston.format` 
- `LEVEL` and `MESSAGE` symbols exposed through [triple-beam].
- [Shared test suite][abstract-winston-transport] for community transports 

Let's dig in deeper. The example below has been annotated to demonstrate the different packages that compose the example itself:

``` js
const { createLogger, transports, format } = require('winston');
const Transport = require('winston-transport');
const logform = require('logform');
const { combine, timestamp, label, printf } = logform.format;

// winston.format is require('logform')
console.log(logform.format === format) // true

const logger = createLogger({
  format: combine(
    label({ label: 'right meow!' }),
    timestamp(),
    printf(({ level, message, label, timestamp }) => {
      return `${timestamp} [${label}] ${level}: ${message}`;
    })
  ),
  transports: [new transports.Console()]
});
```

## What about `winston@2.x`?!

> _If you are opening an issue regarding the `2.x` release-line please know
> that 2.x work has ceased. The `winston` team will review PRs that fix
> issues, but as issues are opened we will close them._

You will commonly see this closing `winston@2.x` issues:

```
Development `winston@2.x` has ceased. Please consider upgrading to
`winston@3.0.0`. If you feel strongly about this bug please open a PR against
the `2.x` branch. Thank you for using `winston`!
```

## Could this be implemented as a format?

Before opening issues for new features consider if this feature could be implemented as a [custom format]. If it is, you will see your issue closed with this message:

```
This can be accomplished with using [custom formats](https://github.com/winstonjs/winston#creating-custom-formats) in `winston@3.0.0`. Please consider upgrading.
```

# Roadmap

Below is the list of items that make up the roadmap through `3.4.0`. We are actively triaging the open issues, so it is likely a few more critical path items will be added to this list before the next release goes out.

- [Version 3.3.0](#version-320)
- [Version 3.4.0](#version-330)
- [Version 3.5.0](#version-340)

## Legend

- [ ] Unstarted work.
- [x] Finished work.
- [-] Partially finished or in-progress work. 

## Version `3.3.0`

### High priority issues (non-blocking)
- [ ] Move `File` transport into `winston-file`.
- [Browser support](https://github.com/winstonjs/winston/issues/287)
  - [ ] Unit tests for `webpack` & `rollup` 
  - [ ] Replicate browser-only transpilation for `winston`, `winston-transport`, `triple-beam`.
- [-] Full JSDoc coverage
- Benchmarking for `File` and `Stream` transports:
   - [x] Benchmarking integration in `pino`.
   - [x] Upgrade `pino` to latest `winston`.
   - See: https://github.com/winstonjs/logmark
   - See also: https://github.com/pinojs/pino/pull/232
- [ ] Move `logged` event into `winston-transport` to remove need for it in each individual Transport written _or remove the `logged` event entirely._

### Increased code & scenario coverage
- [-] Replace all `vows`-based tests.
  - [-] `test/transports/*-test.js` 
- [ ] Code coverage tests above 80% for `winston` _(currently `~70%`)_.
  - [-] Core scenarios covered in `abstract-winston-transport`.
  - [-] Full integration tests for all `logform` transports

### Communications / Compatibility
- [ ] `README.md` for `winston-compat`.
- [ ] Update all transports documented in `docs/transports.md` for `winston@3`.

## Version `3.4.0`

### Querying, Streaming, Uncaught Exceptions
- [-] Streaming

### Communications / Compatibility
- [ ] `winstonjs.org` documentation site.

## Version `3.5.0`

### Querying, Streaming, Uncaught Exceptions
- [-] Querying

[winston-transport]: https://github.com/winstonjs/winston-transport
[logform]: https://github.com/winstonjs/logform
[triple-beam]: https://github.com/winstonjs/triple-beam
[abstract-winston-transport]: https://github.com/winstonjs/abstract-winston-transport
[stress-test]: https://github.com/winstonjs/winston/blob/master/test/transports/file-stress.test.js
[custom format]: https://github.com/winstonjs/winston#creating-custom-formats


================================================
FILE: LICENSE
================================================
Copyright (c) 2010 Charlie Robbins

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

================================================
FILE: README.md
================================================
# winston

A logger for just about everything.

[![Version npm](https://img.shields.io/npm/v/winston.svg?style=flat-square)](https://www.npmjs.com/package/winston)
[![npm Downloads](https://img.shields.io/npm/dm/winston.svg?style=flat-square)](https://npmcharts.com/compare/winston?minimal=true)
[![build status](https://github.com/winstonjs/winston/actions/workflows/ci.yml/badge.svg)](https://github.com/winstonjs/winston/actions/workflows/ci.yml)
[![coverage status](https://coveralls.io/repos/github/winstonjs/winston/badge.svg?branch=master)](https://coveralls.io/github/winstonjs/winston?branch=master)

[![NPM](https://nodei.co/npm/winston.png?downloads=true&downloadRank=true)](https://nodei.co/npm/winston/)

## winston@3

See the [Upgrade Guide](UPGRADE-3.0.md) for more information. Bug reports and
PRs welcome!

## Looking for `winston@2.x` documentation?

Please note that the documentation below is for `winston@3`.
[Read the `winston@2.x` documentation].

## Motivation

`winston` is designed to be a simple and universal logging library with
support for multiple transports. A transport is essentially a storage device
for your logs. Each `winston` logger can have multiple transports (see:
[Transports]) configured at different levels (see: [Logging levels]). For
example, one may want error logs to be stored in a persistent remote location
(like a database), but all logs output to the console or a local file.

`winston` aims to decouple parts of the logging process to make it more
flexible and extensible. Attention is given to supporting flexibility in log
formatting (see: [Formats]) & levels (see: [Using custom logging levels]), and
ensuring those APIs decoupled from the implementation of transport logging
(i.e. how the logs are stored / indexed, see: [Adding Custom Transports]) to
the API that they exposed to the programmer.

## Quick Start

TL;DR? Check out the [quick start example][quick-example] in `./examples/`.
There are a number of other examples in [`./examples/*.js`][examples].
Don't see an example you think should be there? Submit a pull request
to add it!

## Usage

The recommended way to use `winston` is to create your own logger. The
simplest way to do this is using `winston.createLogger`:

``` js
const winston = require('winston');

const logger = winston.createLogger({
  level: 'info',
  format: winston.format.json(),
  defaultMeta: { service: 'user-service' },
  transports: [
    //
    // - Write all logs with importance level of `error` or higher to `error.log`
    //   (i.e., error, fatal, but not other levels)
    //
    new winston.transports.File({ filename: 'error.log', level: 'error' }),
    //
    // - Write all logs with importance level of `info` or higher to `combined.log`
    //   (i.e., fatal, error, warn, and info, but not trace)
    //
    new winston.transports.File({ filename: 'combined.log' }),
  ],
});

//
// If we're not in production then log to the `console` with the format:
// `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
//
if (process.env.NODE_ENV !== 'production') {
  logger.add(new winston.transports.Console({
    format: winston.format.simple(),
  }));
}
```

You may also log directly via the default logger exposed by
`require('winston')`, but this merely intended to be a convenient shared
logger to use throughout your application if you so choose.
Note that the default logger doesn't have any transports by default.
You need add transports by yourself, and leaving the default logger without any
transports may produce a high memory usage issue.

## Table of contents

* [Motivation](#motivation)
* [Quick Start](#quick-start)
* [Usage](#usage)
* [Table of Contents](#table-of-contents)
* [Logging](#logging)
  * [Creating your logger](#creating-your-own-logger)
  * [Streams, `objectMode`, and `info` objects](#streams-objectmode-and-info-objects)
* [Formats]
  * [Combining formats](#combining-formats)
  * [String interpolation](#string-interpolation)
  * [Filtering `info` Objects](#filtering-info-objects)
  * [Creating custom formats](#creating-custom-formats)
* [Logging levels]
  * [Using logging levels](#using-logging-levels)
  * [Using custom logging levels](#using-custom-logging-levels)
* [Transports]
  * [Multiple transports of the same type](#multiple-transports-of-the-same-type)
  * [Adding Custom Transports](#adding-custom-transports)
  * [Common Transport options](#common-transport-options)
* [Exceptions](#exceptions)
  * [Handling Uncaught Exceptions with winston](#handling-uncaught-exceptions-with-winston)
  * [To Exit or Not to Exit](#to-exit-or-not-to-exit)
* [Rejections](#rejections)
  * [Handling Uncaught Promise Rejections with winston](#handling-uncaught-promise-rejections-with-winston)
* [Profiling](#profiling)
* [Streaming Logs](#streaming-logs)
* [Querying Logs](#querying-logs)
* [Further Reading](#further-reading)
  * [Using the default logger](#using-the-default-logger)
  * [Awaiting logs to be written in `winston`](#awaiting-logs-to-be-written-in-winston)
  * [Working with multiple Loggers in `winston`](#working-with-multiple-loggers-in-winston)
  * [Routing Console transport messages to the console instead of stdout and stderr](#routing-console-transport-messages-to-the-console-instead-of-stdout-and-stderr)
* [Installation](#installation)
* [Run Tests](#run-tests)

## Logging

Logging levels in `winston` conform to the severity ordering specified by
[RFC5424]: _severity of all levels is assumed to be numerically **ascending**
from most important to least important._

``` js
const levels = {
  error: 0,
  warn: 1,
  info: 2,
  http: 3,
  verbose: 4,
  debug: 5,
  silly: 6
};
```

### Creating your own Logger
You get started by creating a logger using `winston.createLogger`:

``` js
const logger = winston.createLogger({
  transports: [
    new winston.transports.Console(),
    new winston.transports.File({ filename: 'combined.log' })
  ]
});
```

A logger accepts the following parameters:

| Name          | Default                     |  Description    |
| ------------- | --------------------------- | --------------- |
| `level`       | `'info'`                    | Log only if [`info.level`](#streams-objectmode-and-info-objects) is less than or equal to this level  |
| `levels`      | `winston.config.npm.levels` | Levels (and colors) representing log priorities            |
| `format`      | `winston.format.json`       | Formatting for `info` messages  (see: [Formats])           |
| `transports`  | `[]` _(No transports)_      | Set of logging targets for `info` messages                 |
| `exitOnError` | `true`                      | If false, handled exceptions will not cause `process.exit` |
| `silent`      | `false`                     | If true, all logs are suppressed |

The levels provided to `createLogger` will be defined as convenience methods
on the `logger` returned.

``` js
//
// Logging
//
logger.log({
  level: 'info',
  message: 'Hello distributed log files!'
});

logger.info('Hello again distributed logs');
```

You can add or remove transports from the `logger` once it has been provided
to you from `winston.createLogger`:

``` js
const files = new winston.transports.File({ filename: 'combined.log' });
const console = new winston.transports.Console();

logger
  .clear()          // Remove all transports
  .add(console)     // Add console transport
  .add(files)       // Add file transport
  .remove(console); // Remove console transport
```

You can also wholesale reconfigure a `winston.Logger` instance using the
`configure` method:

``` js
const logger = winston.createLogger({
  level: 'info',
  transports: [
    new winston.transports.Console(),
    new winston.transports.File({ filename: 'combined.log' })
  ]
});

//
// Replaces the previous transports with those in the
// new configuration wholesale.
//
const DailyRotateFile = require('winston-daily-rotate-file');
logger.configure({
  level: 'verbose',
  transports: [
    new DailyRotateFile(opts)
  ]
});
```

### Creating child loggers

You can create child loggers from existing loggers to pass metadata overrides:

``` js
const logger = winston.createLogger({
  transports: [
    new winston.transports.Console(),
  ]
});

const childLogger = logger.child({ requestId: '451' });
```
> `.child` is likely to be bugged if you're also extending the `Logger` class, due to some implementation details that make `this` keyword to point to unexpected things. Use with caution.

### Streams, `objectMode`, and `info` objects

In `winston`, both `Logger` and `Transport` instances are treated as
[`objectMode`](https://nodejs.org/api/stream.html#stream_object_mode)
streams that accept an `info` object.

The `info` parameter provided to a given format represents a single log
message. The object itself is mutable. Every `info` must have at least the
`level` and `message` properties:

``` js
const info = {
  level: 'info',                 // Level of the logging message
  message: 'Hey! Log something?' // Descriptive message being logged.
};
```

Properties **besides level and message** are considered as "`meta`". i.e.:

``` js
const { level, message, ...meta } = info;
```

Several of the formats in `logform` itself add additional properties:

| Property    | Format added by | Description |
| ----------- | --------------- | ----------- |
| `splat`     | `splat()`       | String interpolation splat for `%d %s`-style messages. |
| `timestamp` | `timestamp()`   |  timestamp the message was received. |
| `label`     | `label()`       | Custom label associated with each message. |
| `ms`        | `ms()`          | Number of milliseconds since the previous log message. |

As a consumer you may add whatever properties you wish – _internal state is
maintained by `Symbol` properties:_

- `Symbol.for('level')` _**(READ-ONLY)**:_ equal to `level` property.
  **Is treated as immutable by all code.**
- `Symbol.for('message'):` complete string message set by "finalizing formats":
  - `json`
  - `logstash`
  - `printf`
  - `prettyPrint`
  - `simple`
- `Symbol.for('splat')`: additional string interpolation arguments. _Used
  exclusively by `splat()` format._

These Symbols are stored in another package: `triple-beam` so that all
consumers of `logform` can have the same Symbol reference. i.e.:

``` js
const { LEVEL, MESSAGE, SPLAT } = require('triple-beam');

console.log(LEVEL === Symbol.for('level'));
// true

console.log(MESSAGE === Symbol.for('message'));
// true

console.log(SPLAT === Symbol.for('splat'));
// true
```

> **NOTE:** any `{ message }` property in a `meta` object provided will
> automatically be concatenated to any `msg` already provided: For
> example the below will concatenate 'world' onto 'hello':
>
> ``` js
> logger.log('error', 'hello', { message: 'world' });
> logger.info('hello', { message: 'world' });
> ```

## Formats

Formats in `winston` can be accessed from `winston.format`. They are
implemented in [`logform`](https://github.com/winstonjs/logform), a separate
module from `winston`. This allows flexibility when writing your own transports
in case you wish to include a default format with your transport.

In modern versions of `node` template strings are very performant and are the
recommended way for doing most end-user formatting. If you want to bespoke
format your logs, `winston.format.printf` is for you:

``` js
const { createLogger, format, transports } = require('winston');
const { combine, timestamp, label, printf } = format;

const myFormat = printf(({ level, message, label, timestamp }) => {
  return `${timestamp} [${label}] ${level}: ${message}`;
});

const logger = createLogger({
  format: combine(
    label({ label: 'right meow!' }),
    timestamp(),
    myFormat
  ),
  transports: [new transports.Console()]
});
```

To see what built-in formats are available and learn more about creating your
own custom logging formats, see [`logform`][logform].

### Combining formats

Any number of formats may be combined into a single format using
`format.combine`. Since `format.combine` takes no `opts`, as a convenience it
returns pre-created instance of the combined format.

``` js
const { createLogger, format, transports } = require('winston');
const { combine, timestamp, label, prettyPrint } = format;

const logger = createLogger({
  format: combine(
    label({ label: 'right meow!' }),
    timestamp(),
    prettyPrint()
  ),
  transports: [new transports.Console()]
})

logger.log({
  level: 'info',
  message: 'What time is the testing at?'
});
// Outputs:
// { level: 'info',
//   message: 'What time is the testing at?',
//   label: 'right meow!',
//   timestamp: '2017-09-30T03:57:26.875Z' }
```

### String interpolation

The `log` method provides the string interpolation using [util.format]. **It
must be enabled using `format.splat()`.**

Below is an example that defines a format with string interpolation of
messages using `format.splat` and then serializes the entire `info` message
using `format.simple`.

``` js
const { createLogger, format, transports } = require('winston');
const logger = createLogger({
  format: format.combine(
    format.splat(),
    format.simple()
  ),
  transports: [new transports.Console()]
});

// info: test message my string {}
logger.log('info', 'test message %s', 'my string');

// info: test message 123 {}
logger.log('info', 'test message %d', 123);

// info: test message first second {number: 123}
logger.log('info', 'test message %s, %s', 'first', 'second', { number: 123 });
```

### Filtering `info` Objects

If you wish to filter out a given `info` Object completely when logging then
simply return a falsey value.

``` js
const { createLogger, format, transports } = require('winston');

// Ignore log messages if they have { private: true }
const ignorePrivate = format((info, opts) => {
  if (info.private) { return false; }
  return info;
});

const logger = createLogger({
  format: format.combine(
    ignorePrivate(),
    format.json()
  ),
  transports: [new transports.Console()]
});

// Outputs: {"level":"error","message":"Public error to share"}
logger.log({
  level: 'error',
  message: 'Public error to share'
});

// Messages with { private: true } will not be written when logged.
logger.log({
  private: true,
  level: 'error',
  message: 'This is super secret - hide it.'
});
```

Use of `format.combine` will respect any falsey values return and stop
evaluation of later formats in the series. For example:

``` js
const { format } = require('winston');
const { combine, timestamp, label } = format;

const willNeverThrow = format.combine(
  format(info => { return false })(), // Ignores everything
  format(info => { throw new Error('Never reached') })()
);
```

### Creating custom formats

Formats are prototypal objects (i.e. class instances) that define a single
method: `transform(info, opts)` and return the mutated `info`:

- `info`: an object representing the log message.
- `opts`: setting specific to the current instance of the format.

They are expected to return one of two things:

- **An `info` Object** representing the modified `info` argument. Object
references need not be preserved if immutability is preferred. All current
built-in formats consider `info` mutable, but [immutablejs] is being
considered for future releases.
- **A falsey value** indicating that the `info` argument should be ignored by the
caller. (See: [Filtering `info` Objects](#filtering-info-objects)) below.

`winston.format` is designed to be as simple as possible. To define a new
format, simply pass it a `transform(info, opts)` function to get a new
`Format`.

The named `Format` returned can be used to create as many copies of the given
`Format` as desired:

``` js
const { format } = require('winston');

const volume = format((info, opts) => {
  if (opts.yell) {
    info.message = info.message.toUpperCase();
  } else if (opts.whisper) {
    info.message = info.message.toLowerCase();
  }

  return info;
});

// `volume` is now a function that returns instances of the format.
const scream = volume({ yell: true });
console.dir(scream.transform({
  level: 'info',
  message: `sorry for making you YELL in your head!`
}, scream.options));
// {
//   level: 'info'
//   message: 'SORRY FOR MAKING YOU YELL IN YOUR HEAD!'
// }

// `volume` can be used multiple times to create different formats.
const whisper = volume({ whisper: true });
console.dir(whisper.transform({
  level: 'info',
  message: `WHY ARE THEY MAKING US YELL SO MUCH!`
}, whisper.options));
// {
//   level: 'info'
//   message: 'why are they making us yell so much!'
// }
```

## Logging Levels

Logging levels in `winston` conform to the severity ordering specified by
[RFC5424]: _severity of all levels is assumed to be numerically **ascending**
from most important to least important._

Each `level` is given a specific integer priority. The higher the priority the
more important the message is considered to be, and the lower the
corresponding integer priority.  For example, as specified exactly in RFC5424
the `syslog` levels are prioritized from 0 to 7 (highest to lowest).

```js
{
  emerg: 0,
  alert: 1,
  crit: 2,
  error: 3,
  warning: 4,
  notice: 5,
  info: 6,
  debug: 7
}
```

Similarly, `npm` logging levels are prioritized from 0 to 6 (highest to
lowest):

``` js
{
  error: 0,
  warn: 1,
  info: 2,
  http: 3,
  verbose: 4,
  debug: 5,
  silly: 6
}
```

If you do not explicitly define the levels that `winston` should use, the
`npm` levels above will be used.

### Using Logging Levels

Setting the level for your logging message can be accomplished in one of two
ways. You can pass a string representing the logging level to the log() method
or use the level specified methods defined on every winston Logger.

``` js
//
// Any logger instance
//
logger.log('silly', "127.0.0.1 - there's no place like home");
logger.log('debug', "127.0.0.1 - there's no place like home");
logger.log('verbose', "127.0.0.1 - there's no place like home");
logger.log('info', "127.0.0.1 - there's no place like home");
logger.log('warn', "127.0.0.1 - there's no place like home");
logger.log('error', "127.0.0.1 - there's no place like home");
logger.info("127.0.0.1 - there's no place like home");
logger.warn("127.0.0.1 - there's no place like home");
logger.error("127.0.0.1 - there's no place like home");

//
// Default logger
//
winston.log('info', "127.0.0.1 - there's no place like home");
winston.info("127.0.0.1 - there's no place like home");
```

`winston` allows you to define a `level` property on each transport which
specifies the **maximum** level of messages that a transport should log. For
example, using the `syslog` levels you could log only `error` messages to the
console and everything `info` and below to a file (which includes `error`
messages):

``` js
const logger = winston.createLogger({
  levels: winston.config.syslog.levels,
  transports: [
    new winston.transports.Console({ level: 'error' }),
    new winston.transports.File({
      filename: 'combined.log',
      level: 'info'
    })
  ]
});
```

You may also dynamically change the log level of a transport:

``` js
const transports = {
  console: new winston.transports.Console({ level: 'warn' }),
  file: new winston.transports.File({ filename: 'combined.log', level: 'error' })
};

const logger = winston.createLogger({
  transports: [
    transports.console,
    transports.file
  ]
});

logger.info('Will not be logged in either transport!');
transports.console.level = 'info';
transports.file.level = 'info';
logger.info('Will be logged in both transports!');
```

`winston` supports customizable logging levels, defaulting to npm style
logging levels. Levels must be specified at the time of creating your logger.

### Using Custom Logging Levels

In addition to the predefined `npm`, `syslog`, and `cli` levels available in
`winston`, you can also choose to define your own:

``` js
const myCustomLevels = {
  levels: {
    foo: 0,
    bar: 1,
    baz: 2,
    foobar: 3
  },
  colors: {
    foo: 'blue',
    bar: 'green',
    baz: 'yellow',
    foobar: 'red'
  }
};

const customLevelLogger = winston.createLogger({
  levels: myCustomLevels.levels
});

customLevelLogger.foobar('some foobar level-ed message');
```

Although there is slight repetition in this data structure, it enables simple
encapsulation if you do not want to have colors. If you do wish to have
colors, in addition to passing the levels to the Logger itself, you must make
winston aware of them:

``` js
winston.addColors(myCustomLevels.colors);
```

This enables loggers using the `colorize` formatter to appropriately color and style
the output of custom levels.

Additionally, you can also change background color and font style.
For example,
``` js
baz: 'italic yellow',
foobar: 'bold red cyanBG'
```

Possible options are below.

* Font styles: `bold`, `dim`, `italic`, `underline`, `inverse`, `hidden`,
  `strikethrough`.

* Font foreground colors: `black`, `red`, `green`, `yellow`, `blue`, `magenta`,
  `cyan`, `white`, `gray`, `grey`.

* Background colors: `blackBG`, `redBG`, `greenBG`, `yellowBG`, `blueBG`
  `magentaBG`, `cyanBG`, `whiteBG`

### Colorizing Standard logging levels

To colorize the standard logging level add
```js
winston.format.combine(
  winston.format.colorize(),
  winston.format.simple()
);
```
where `winston.format.simple()` is whatever other formatter you want to use.  The `colorize` formatter must come before any formatters adding text you wish to color.

### Colorizing full log line when json formatting logs

To colorize the full log line with the json formatter you can apply the following

```js
winston.format.combine(
  winston.format.json(),
  winston.format.colorize({ all: true })
);
```

## Transports

There are several [core transports] included in  `winston`, which leverage the
built-in networking and file I/O offered by Node.js core. In addition, there
are [additional transports] written by members of the community.

## Multiple transports of the same type

It is possible to use multiple transports of the same type e.g.
`winston.transports.File` when you construct the transport.

``` js
const logger = winston.createLogger({
  transports: [
    new winston.transports.File({
      filename: 'combined.log',
      level: 'info'
    }),
    new winston.transports.File({
      filename: 'errors.log',
      level: 'error'
    })
  ]
});
```

If you later want to remove one of these transports you can do so by using the
transport itself. e.g.:

``` js
const combinedLogs = logger.transports.find(transport => {
  return transport.filename === 'combined.log'
});

logger.remove(combinedLogs);
```

## Adding Custom Transports

Adding a custom transport is easy. All you need to do is accept any options
you need, implement a log() method, and consume it with `winston`.

``` js
const Transport = require('winston-transport');
const util = require('util');

//
// Inherit from `winston-transport` so you can take advantage
// of the base functionality and `.exceptions.handle()`.
//
module.exports = class YourCustomTransport extends Transport {
  constructor(opts) {
    super(opts);
    //
    // Consume any custom options here. e.g.:
    // - Connection information for databases
    // - Authentication information for APIs (e.g. loggly, papertrail,
    //   logentries, etc.).
    //
  }

  log(info, callback) {
    setImmediate(() => {
      this.emit('logged', info);
    });

    // Perform the writing to the remote service
    callback();
  }
};
```

## Common Transport options

As every transport inherits from [winston-transport], it's possible to set
a custom format and a custom log level on each transport separately:

``` js
const logger = winston.createLogger({
  transports: [
    new winston.transports.File({
      filename: 'error.log',
      level: 'error',
      format: winston.format.json()
    }),
    new winston.transports.Http({
      level: 'warn',
      format: winston.format.json()
    }),
    new winston.transports.Console({
      level: 'info',
      format: winston.format.combine(
        winston.format.colorize(),
        winston.format.simple()
      )
    })
  ]
});
```

## Exceptions

### Handling Uncaught Exceptions with winston

With `winston`, it is possible to catch and log `uncaughtException` events
from your process. With your own logger instance you can enable this behavior
when it's created or later on in your applications lifecycle:

``` js
const { createLogger, transports } = require('winston');

// Enable exception handling when you create your logger.
const logger = createLogger({
  transports: [
    new transports.File({ filename: 'combined.log' })
  ],
  exceptionHandlers: [
    new transports.File({ filename: 'exceptions.log' })
  ]
});

// Or enable it later on by adding a transport or using `.exceptions.handle`
const logger = createLogger({
  transports: [
    new transports.File({ filename: 'combined.log' })
  ]
});

// Call exceptions.handle with a transport to handle exceptions
logger.exceptions.handle(
  new transports.File({ filename: 'exceptions.log' })
);
```

If you want to use this feature with the default logger, simply call
`.exceptions.handle()` with a transport instance.

``` js
//
// You can add a separate exception logger by passing it to `.exceptions.handle`
//
winston.exceptions.handle(
  new winston.transports.File({ filename: 'path/to/exceptions.log' })
);

//
// Alternatively you can set `handleExceptions` to true when adding transports
// to winston.
//
winston.add(new winston.transports.File({
  filename: 'path/to/combined.log',
  handleExceptions: true
}));
```

### To Exit or Not to Exit

By default, winston will exit after logging an uncaughtException. If this is
not the behavior you want, set `exitOnError = false`

``` js
const logger = winston.createLogger({ exitOnError: false });

//
// or, like this:
//
logger.exitOnError = false;
```

When working with custom logger instances, you can pass in separate transports
to the `exceptionHandlers` property or set `handleExceptions` on any
transport.

##### Example 1

``` js
const logger = winston.createLogger({
  transports: [
    new winston.transports.File({ filename: 'path/to/combined.log' })
  ],
  exceptionHandlers: [
    new winston.transports.File({ filename: 'path/to/exceptions.log' })
  ]
});
```

##### Example 2

``` js
const logger = winston.createLogger({
  transports: [
    new winston.transports.Console({
      handleExceptions: true
    })
  ],
  exitOnError: false
});
```

The `exitOnError` option can also be a function to prevent exit on only
certain types of errors:

``` js
function ignoreEpipe(err) {
  return err.code !== 'EPIPE';
}

const logger = winston.createLogger({ exitOnError: ignoreEpipe });

//
// or, like this:
//
logger.exitOnError = ignoreEpipe;
```

## Rejections

### Handling Uncaught Promise Rejections with winston

With `winston`, it is possible to catch and log `unhandledRejection` events
from your process. With your own logger instance you can enable this behavior
when it's created or later on in your applications lifecycle:

``` js
const { createLogger, transports } = require('winston');

// Enable rejection handling when you create your logger.
const logger = createLogger({
  transports: [
    new transports.File({ filename: 'combined.log' })
  ],
  rejectionHandlers: [
    new transports.File({ filename: 'rejections.log' })
  ]
});

// Or enable it later on by adding a transport or using `.rejections.handle`
const logger = createLogger({
  transports: [
    new transports.File({ filename: 'combined.log' })
  ]
});

// Call rejections.handle with a transport to handle rejections
logger.rejections.handle(
  new transports.File({ filename: 'rejections.log' })
);
```

If you want to use this feature with the default logger, simply call
`.rejections.handle()` with a transport instance.

``` js
//
// You can add a separate rejection logger by passing it to `.rejections.handle`
//
winston.rejections.handle(
  new winston.transports.File({ filename: 'path/to/rejections.log' })
);

//
// Alternatively you can set `handleRejections` to true when adding transports
// to winston.
//
winston.add(new winston.transports.File({
  filename: 'path/to/combined.log',
  handleRejections: true
}));
```

## Profiling

In addition to logging messages and metadata, `winston` also has a simple
profiling mechanism implemented for any logger:

``` js
//
// Start profile of 'test'
//
logger.profile('test');

setTimeout(function () {
  //
  // Stop profile of 'test'. Logging will now take place:
  //   '17 Jan 21:00:00 - info: test duration=1000ms'
  //
  logger.profile('test');
}, 1000);
```

Also you can start a timer and keep a reference that you can call `.done()`
on:

``` js
 // Returns an object corresponding to a specific timing. When done
 // is called the timer will finish and log the duration. e.g.:
 //
 const profiler = logger.startTimer();
 setTimeout(function () {
   profiler.done({ message: 'Logging message' });
 }, 1000);
```

All profile messages are set to 'info' level by default, and both message and
metadata are optional.  For individual profile messages, you can override the default log level by supplying a metadata object with a `level` property:

```js
logger.profile('test', { level: 'debug' });
```

## Querying Logs

`winston` supports querying of logs with Loggly-like options. [See Loggly
Search API](https://www.loggly.com/docs/api-retrieving-data/). Specifically:
`File`, `Couchdb`, `Redis`, `Loggly`, `Nssocket`, and `Http`.

``` js
const options = {
  from: new Date() - (24 * 60 * 60 * 1000),
  until: new Date(),
  limit: 10,
  start: 0,
  order: 'desc',
  fields: ['message']
};

//
// Find items logged between today and yesterday.
//
logger.query(options, function (err, results) {
  if (err) {
    /* TODO: handle me */
    throw err;
  }

  console.log(results);
});
```

## Streaming Logs
Streaming allows you to stream your logs back from your chosen transport.

``` js
//
// Start at the end.
//
winston.stream({ start: -1 }).on('log', function(log) {
  console.log(log);
});
```

## Further Reading

### Using the Default Logger

The default logger is accessible through the `winston` module directly. Any
method that you could call on an instance of a logger is available on the
default logger:

``` js
const winston = require('winston');

winston.log('info', 'Hello distributed log files!');
winston.info('Hello again distributed logs');

winston.level = 'debug';
winston.log('debug', 'Now my debug messages are written to console!');
```

By default, no transports are set on the default logger. You must
add or remove transports via the `add()` and `remove()` methods:

``` js
const files = new winston.transports.File({ filename: 'combined.log' });
const console = new winston.transports.Console();

winston.add(console);
winston.add(files);
winston.remove(console);
```

Or do it with one call to configure():

``` js
winston.configure({
  transports: [
    new winston.transports.File({ filename: 'somefile.log' })
  ]
});
```

For more documentation about working with each individual transport supported
by `winston` see the [`winston` Transports](docs/transports.md) document.

### Awaiting logs to be written in `winston`

Often it is useful to wait for your logs to be written before exiting the
process. Each instance of `winston.Logger` is also a [Node.js stream]. A
`finish` event will be raised when all logs have flushed to all transports
after the stream has been ended.

``` js
const transport = new winston.transports.Console();
const logger = winston.createLogger({
  transports: [transport]
});

logger.on('finish', function (info) {
  // All `info` log messages has now been logged
});

logger.info('CHILL WINSTON!', { seriously: true });
logger.end();
```

It is also worth mentioning that the logger also emits an 'error' event
if an error occurs within the logger itself which
you should handle or suppress if you don't want unhandled exceptions:

``` js
//
// Handle errors originating in the logger itself
//
logger.on('error', function (err) { /* Do Something */ });
```

### Working with multiple Loggers in winston

Often in larger, more complex, applications it is necessary to have multiple
logger instances with different settings. Each logger is responsible for a
different feature area (or category). This is exposed in `winston` in two
ways: through `winston.loggers` and instances of `winston.Container`. In fact,
`winston.loggers` is just a predefined instance of `winston.Container`:

``` js
const winston = require('winston');
const { format } = winston;
const { combine, label, json } = format;

//
// Configure the logger for `category1`
//
winston.loggers.add('category1', {
  format: combine(
    label({ label: 'category one' }),
    json()
  ),
  transports: [
    new winston.transports.Console({ level: 'silly' }),
    new winston.transports.File({ filename: 'somefile.log' })
  ]
});

//
// Configure the logger for `category2`
//
winston.loggers.add('category2', {
  format: combine(
    label({ label: 'category two' }),
    json()
  ),
  transports: [
    new winston.transports.Http({ host: 'localhost', port:8080 })
  ]
});
```

Now that your loggers are setup, you can require winston _in any file in your
application_ and access these pre-configured loggers:

``` js
const winston = require('winston');

//
// Grab your preconfigured loggers
//
const category1 = winston.loggers.get('category1');
const category2 = winston.loggers.get('category2');

category1.info('logging to file and console transports');
category2.info('logging to http transport');
```

If you prefer to manage the `Container` yourself, you can simply instantiate one:

``` js
const winston = require('winston');
const { format } = winston;
const { combine, label, json } = format;

const container = new winston.Container();

container.add('category1', {
  format: combine(
    label({ label: 'category one' }),
    json()
  ),
  transports: [
    new winston.transports.Console({ level: 'silly' }),
    new winston.transports.File({ filename: 'somefile.log' })
  ]
});

const category1 = container.get('category1');
category1.info('logging to file and console transports');
```

### Routing Console transport messages to the console instead of stdout and stderr

By default the `winston.transports.Console` transport sends messages to `stdout` and `stderr`. This
is fine in most situations; however, there are some cases where this isn't desirable, including:

- Debugging using VSCode and attaching to, rather than launching, a Node.js process
- Writing JSON format messages in AWS Lambda
- Logging during Jest tests with the `--silent` option

To make the transport log use `console.log()`, `console.warn()` and `console.error()`
instead, set the `forceConsole` option to `true`:

```js
const logger = winston.createLogger({
  level: 'info',
  transports: [new winston.transports.Console({ forceConsole: true })]
});
```

## Installation

``` bash
npm install winston
```

``` bash
yarn add winston
```

## Run Tests

``` bash
npm test # Runs all tests
npm run test:unit # Runs all Unit tests with coverage
npm run test:integration # Runs all integration tests
npm run test:typescript # Runs tests verifying Typescript types
```

All of the winston tests are written with [jest]. Assertions use a mix of [assume] and the built-in jest assertion library.

#### Author: [Charlie Robbins]
#### Contributors: [Jarrett Cruger], [David Hyde], [Chris Alderson], [Jonathon Terry]

[Transports]: #transports
[Logging levels]: #logging-levels
[Formats]: #formats
[Using custom logging levels]: #using-custom-logging-levels
[Adding Custom Transports]: #adding-custom-transports
[core transports]: docs/transports.md#winston-core
[additional transports]: docs/transports.md#additional-transports

[RFC5424]: https://tools.ietf.org/html/rfc5424
[util.format]: https://nodejs.org/dist/latest/docs/api/util.html#util_util_format_format_args
[assume]: https://github.com/bigpipe/assume
[logform]: https://github.com/winstonjs/logform#readme
[winston-transport]: https://github.com/winstonjs/winston-transport
[jest]: https://jestjs.io/

[Read the `winston@2.x` documentation]: https://github.com/winstonjs/winston/tree/2.x

[quick-example]: https://github.com/winstonjs/winston/blob/master/examples/quick-start.js
[examples]: https://github.com/winstonjs/winston/tree/master/examples

[Charlie Robbins]: http://github.com/indexzero
[Jarrett Cruger]: https://github.com/jcrugzz
[David Hyde]: https://github.com/dabh
[Chris Alderson]: https://github.com/chrisalderson
[Jonathon Terry]: https://github.com/maverick1872


================================================
FILE: SECURITY.md
================================================
# Security Policy

## Reporting a Vulnerability

Please report security issues to `npm view yadeep maintainers.email`.


================================================
FILE: UPGRADE-3.0.md
================================================
# Upgrading to `winston@3.0.0`

> This document represents a **living guide** on upgrading to `winston@3`.
> Much attention has gone into the details, but if you are having trouble
> upgrading to `winston@3.0.0` **PLEASE** open an issue so we can improve this
> guide! 

- [Breaking changes]
   - [Top-level `winston.*` API]
   - [Transports]
   - [`winston.Container` and `winston.loggers`]
   - [`winston.Logger`]
   - [Exceptions & exception handling]
   - [Other minor breaking changes]
- [Upgrading to `winston.format`]
   - [Removed `winston.Logger` formatting options]
   - [Removed `winston.transports.{File,Console,Http}` formatting options]
   - [Migrating `filters` and `rewriters` to `formats` in `winston@3`]
- [Modularity: `winston-transport`, `logform` and more]

## Breaking changes

### Top-level `winston.*` API
- `winston.Logger` has been replaced with `winston.createLogger`.
- `winston.setLevels` has been removed. Levels are frozen at the time of Logger creation.
- Setting the level on the default `winston` logger no longer sets the level on the transports associated with the default `winston` logger.
- The default logger exposed by `require('winston')` no longer has default `Console` transports, 
and leaving it without transports may cause a high memory usage issue.

### Transports
- `winston.transports.Memory` was removed. Use any Node.js `stream.Writeable` with a large `highWaterMark` instance instead.
- When writing transports use `winston-transport` instead of
  `winston.Transport`.
- Many formatting options that were previously configurable on transports 
  (e.g. `json`, `raw`, `colorize`, `prettyPrint`, `timestamp`, `logstash`, 
  `align`) should now be set by adding the appropriate formatter instead.
  _(See: "Removed `winston.transports.{File,Console,Http}` formatting options"
  below)_ 
- In `winston.transports.Console`, output for all log levels are now sent to stdout by default.
    - `stderrLevels` option now defaults to `[]`.
    - `debugStdout` option has been removed.

### `winston.Container` and `winston.loggers`
- `winston.Container` instances no longer have default `Console` transports.
Failing to add any transports may cause a high memory usage issue.
- `winston.Container.prototype.add` no longer does crazy options parsing. Implementation inspired by [segmentio/winston-logger](https://github.com/segmentio/winston-logger/blob/master/lib/index.js#L20-L43)

### `winston.Logger`
- **Do not use** `new winston.Logger(opts)` – it has been removed for
  improved performance. Use `winston.createLogger(opts)` instead.

- `winston.Logger.log` and level-specific methods (`.info`, `.error`, etc)
  **no longer accepts a callback.** The vast majority of use cases for this
  feature was folks awaiting _all logging_ to complete, not just a single
  logging message. To accomplish this:

``` js
logger.log('info', 'some message');
logger.on('finish', () => process.exit());
logger.end();
```

- `winston.Logger.add` no longer accepts prototypes / classes. Pass
  **an instance of our transport instead.**

``` js
// DON'T DO THIS. It will no longer work
logger.add(winston.transports.Console);

// Do this instead.
logger.add(new winston.transports.Console());
```

- `winston.Logger` will no longer do automatic splat interpolation by default.
  Be sure to use `format.splat()` to enable this functionality.
- `winston.Logger` will no longer respond with an error when logging with no
  transports.
- `winston.Logger` will no longer respond with an error if the same transports
  are added twice.
- `Logger.prototype.stream`
  - `options.transport` is removed. Use the transport instance on the logger
    directly.
- `Logger.prototype.query`
  - `options.transport` is removed. Use the transport instance on the logger 
    directly.
- `Logger.paddings` was removed.

### Exceptions & exception handling
- `winston.exception` has been removed. Use:
``` js
const exception = winston.ExceptionHandler();
```
- `humanReadableUnhandledException` is now the default exception format.
- `.unhandleExceptions()` will no longer modify transports state, merely just add / remove the `process.on('uncaughtException')` handler.
   - Call close on any explicit `ExceptionHandlers`.
   - Set `handleExceptions = false` on all transports.

### Other minor breaking changes
- `winston.hash` was removed.
- `winston.common.pad` was removed.
- `winston.common.serialized` was removed (use `winston-compat`).
- `winston.common.log` was removed (use `winston-compat`).
- `winston.paddings` was removed.

## Upgrading to `winston.format`
The biggest issue with `winston@2` and previous major releases was that any
new formatting options required changes to `winston` itself. All formatting is
now handled by **formats**. 

Custom formats can now be created with no changes to `winston` core.
_We encourage you to consider a custom format before opening an issue._

### Removed `winston.Logger` formatting options:
- The default output format is now `format.json()`.
- `filters`: Use a custom `format`. See: [Filters and Rewriters] below.
- `rewriters`: Use a custom `format`. See: [Filters and Rewriters] below.

### Removed `winston.transports.{File,Console,Http}` formatting options
- `stringify`: Use a [custom format].
- `formatter`: Use a [custom format].
- `json`: Use `format.json()`.
- `raw`: Use `format.json()`.
- `label`: Use `format.label()`.
- `logstash`: Use `format.logstash()`.
- `prettyPrint`: Use `format.prettyPrint()` or a [custom format].
   - `depth` is an option provided to `format.prettyPrint()`.
- `colorize`: Use `format.colorize()`.
- `timestamp`: Use `format.timestamp()`.
- `logstash`: Use `format.logstash()`.
- `align`: Use `format.align()`.
- `showLevel`: Use a [custom format].

### Migrating `filters` and `rewriters` to `formats` in `winston@3`

In `winston@3.x.x` `info` objects are considered mutable. The API _combined
formatters and rewriters into a single, new concept:_ **formats**. 

#### Filters

If you are looking to upgrade your `filter` behavior please read on. In
`winston@2.x` this **filter** behavior:

``` js
const isSecret = /super secret/;
const logger = new winston.Logger(options);
logger.filters.push(function(level, msg, meta) {
  return msg.replace(isSecret, 'su*** se****');
});

// Outputs: {"level":"error","message":"Public error to share"}
logger.error('Public error to share');

// Outputs: {"level":"error","message":"This is su*** se**** - hide it."}
logger.error('This is super secret - hide it.');
```

Can be modeled as a **custom format** that you combine with other formats:

``` js
const { createLogger, format, transports } = require('winston');

// Ignore log messages if the have { private: true }
const isSecret = /super secret/;
const filterSecret = format((info, opts) => {
  info.message = info.message.replace(isSecret, 'su*** se****');
  return info;
});

const logger = createLogger({
  format: format.combine(
    filterSecret(),
    format.json()
  ),
  transports: [new transports.Console()]
});

// Outputs: {"level":"error","message":"Public error to share"}
logger.log({
  level: 'error',
  message: 'Public error to share'
});

// Outputs: {"level":"error","message":"This is su*** se**** - hide it."}
logger.log({
  level: 'error',
  message: 'This is super secret - hide it.'
});
```

#### Rewriters

If you are looking to upgrade your `rewriter` behavior please read on. In
`winston@2.x` this **rewriter** behavior:

``` js
const logger = new winston.Logger(options);
logger.rewriters.push(function(level, msg, meta) {
  if (meta.creditCard) {
    meta.creditCard = maskCardNumbers(meta.creditCard)
  }

  return meta;
});

logger.info('transaction ok', { creditCard: 123456789012345 });
```

Can be modeled as a **custom format** that you combine with other formats:

``` js 
const maskFormat = winston.format(info => {
  // You can CHANGE existing property values
  if (info.creditCard) {
    info.creditCard = maskCardNumbers(info.creditCard);
  }

  // You can also ADD NEW properties if you wish
  info.hasCreditCard = !!info.creditCard;

  return info;
});

const logger = winston.createLogger({
  format: winston.format.combine(
    maskFormat(),
    winston.format.json()
  )
});

logger.info('transaction ok', { creditCard: 123456789012345 });
```

See [examples/format-mutate.js](/examples/format-mutate.js) for a complete
end-to-end example that covers both filtering and rewriting behavior in
`winston@2.x`.

## Modularity: `winston-transport`, `logform` and more...

As of `winston@3.0.0` the project has been broken out into a few modules:

- [winston-transport]: `Transport` stream implementation & legacy `Transport`
  wrapper.
- [logform]: All formats exports through `winston.format`. 
- `LEVEL` and `MESSAGE` symbols exposed through [triple-beam].
- [Shared test suite][abstract-winston-transport] for community transports. 

Let's dig in deeper. The example below has been annotated to demonstrate the different packages that compose the example itself:

``` js
const { createLogger, transports, format } = require('winston');
const Transport = require('winston-transport');
const logform = require('logform');
const { combine, timestamp, label, printf } = logform.format;

// winston.format is require('logform')
console.log(logform.format === format) // true

const logger = createLogger({
  format: combine(
    label({ label: 'right meow!' }),
    timestamp(),
    printf(nfo => {
      return `${nfo.timestamp} [${nfo.label}] ${nfo.level}: ${nfo.message}`;
    })
  ),
  transports: [new transports.Console()]
});
```

[Breaking changes]: #breaking-changes
[Top-level `winston.*` API]: #top-level-winston-api
[Transports]: #transports
[`winston.Container` and `winston.loggers`]: #winstoncontainer-and-winstonloggers
[`winston.Logger`]: #winstonlogger
[Exceptions & exception handling]: #exceptions--exception-handling
[Other minor breaking changes]: #other-minor-breaking-changes
[Upgrading to `winston.format`]: #upgrading-to-winstonformat
[Removed `winston.Logger` formatting options]: #removed-winstonlogger-formatting-options
[Removed `winston.transports.{File,Console,Http}` formatting options]: #removed-winstontransportsfileconsolehttp-formatting-options
[Migrating `filters` and `rewriters` to `formats` in `winston@3`]: #migrating-filters-and-rewriters-to-formats-in-winston3
[Modularity: `winston-transport`, `logform` and more]: #modularity-winston-transport-logform-and-more

[Filters and Rewriters]: #migrating-filters-and-rewriters-to-formats-in-winston3
[custom format]: /README.md#creating-custom-formats

[winston-transport]: https://github.com/winstonjs/winston-transport
[logform]: https://github.com/winstonjs/logform
[triple-beam]: https://github.com/winstonjs/triple-beam
[abstract-winston-transport]: https://github.com/winstonjs/abstract-winston-transport



================================================
FILE: docs/publishing.md
================================================
The release process here mostly follows along with the [vbump script](https://github.com/indexzero/vbump) that @indexzero wrote several years ago, but the main steps for a release are as follows:

1. Complete merging in any PRs that should be part of the release.
1. On the [Releases tab](https://github.com/winstonjs/winston/releases) in the GitHub UI, click 'Draft a new release' in the upper right corner.
1. Under the 'Choose a tag' dropdown, type the name of the new version starting with a v (e.g. `v3.7.0`) and don't forget to click the 'Create new tag on publish' option below (this step is annoyingly easy to miss):
![image](https://user-images.githubusercontent.com/563406/160644343-69325988-4ca2-4329-93da-e08266269506.png)
1. Paste the same version number, with or without the v (with is probably better) in the release title box.
1. Click 'Generate release notes' and cut & paste the draft contents into the changelog.
1. Paste the contents of the changelog for this release in the 'Describe this release' box.
1. Check to make sure you've caught everything (including direct commits) using GitHub's compare tool ([example here](https://github.com/winstonjs/winston/compare/v3.6.0...master)).
1. Update the changelog. It's nice to thank the contributors here.  It's nice to organize this by which changes would merit which level of semver bump, and especially call out any breaking changes (major-version-number) concisely at the start.
1. **Update the version number in package.json and package-lock.json**, bumping as appropriate for [semver](https://semver.org/) based on the most significant position change trigger from the changelog you just wrote/reviewed.  Do not miss this step! Also note there are two places in package-lock where this gets updated: at the top level and under the empty-string entry of packages.
1. Update the tag and version number on the Draft a New Release page, with the same number (which might've changed while drafting changelog notes).
1. Make sure your local master branch is up to date.
1. Make sure all the lint checks and tests pass, beyond what the CI might've told you.
1. Paste the contents of the changelog for this release in the 'Describe this release' box on the Draft a Release page.
1. Click "Publish release."
1. Back on the command line, `npm publish` and complete npm 2FA as needed.
1. Update the distribution tags, for example: `npm dist-tag add winston@3.7.0 3.x-latest`.
1. Verify the distribution tags look correct under the 'Versions' tab at https://www.npmjs.com/package/winston or with `npm dist-tag ls`.
1. Keep a closer-than-usual eye on issues in the hours and days that follow, prepared to quickly revert/address anything that might be associated with that release.

A more professional version of this would probably use a release branch off master to make sure no other maintainers merge a PR into master between the loading of a compare view for changelog preparation and completion of the process, but we're such a small team that the extra steps are probably not needed. After release, you can also verify with the compare view between the new and prior release tags to see when the latest change was and verify it was before you started the process.


================================================
FILE: docs/releases.md
================================================
# Past Release Roadmaps

Below is the list of items that made up the roadmap for past releases. 

- [Version 3.0.0](#version-300)

## Legend

- [ ] Unstarted work.
- [x] Finished work.
- [-] Partially finished or in-progress work. 

## Version `3.0.0`

### Show stoppers
- [x] `silent` support.
- [x] Finish `3.0.0` upgrade guide: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md
- [x] Triage all open issues since October 2017

### High priority issues (non-blocking)
- [x] [#1144]: this is _the_ purpose of `winston`. If we cannot log at high-volume we cannot ship out of RC. There was [test coverage for this][stress-test] that should be failing, but isnt. _(Fixed by #1291)._
- [x] Error handling within formats [#1261]
- [x] Update `docs/transports.md`.
- [Type definitions for TypeScript](https://github.com/winstonjs/winston/issues/1096)
  - [x] Supporting libraries: `winston-transport`, `logform`
  - [x] `winston` itself 

### Core logging
- [x] Make `Logger.prototype.level` and `Transport.level` play nice(r) together.
- [x] Remove `new winston.Logger` in favor of `winston.createLogger`.
- [x] Finish implementation for `TransportStream` and `LegacyTransportStream`. 
- [x] Move `TransportStream` and `LegacyTransportStream` into `winston-transport`.
- [x] Move `winston/config.js` to `winston/config/index.js`
- [x] **DEPRECATE** `winston.clone`
- [x] Add convenience methods from `winston-transport`
- [-] Replace all `vows`-based tests.
  - [x] `test/*-test.js`
  - [x] `test/formats/*-test.js` 
  - [-] `test/transports/*-test.js` 
- [x] Move `winston.config` into `triple-beam` around a base `Levels` class.
  _(Fixed in `triple-beam@1.2.0`)_
- [x] Update to the latest `npm` levels (e.g. including `http`).
- [ ] Code coverage tests above 80% for `winston` _(currently `~72%`)_.
- [x] Code coverage tests above 90% for `winston-transport`.
- [x] Code coverage tests above 90% for `logform`
- [-] Core scenarios covered in `abstract-winston-transport`.
- [x] Code coverage tests above 60% for `winston-compat`.

### Transports
- [x] Implement `stream.Writable.writev` in `TransportStream`.
- [x] Refactor all built-in transports to be TransportStream instances.
  - [x] Console
  - [x] File
  - [x] Http
  - [x] Steam

### Formats
- [x] `winston.format.colorize()` format.
- [x] `winston.format.prettyPrint()` format.
- [x] `winston.format.uncolorize()` format.
- [x] `winston.format.logstash()` format.
- [x] `winston.format.cli()`
- [x] String interpolation _(i.e. splat)_ via format
- [x] Use of different formats across multiple Transports. e.g.:
   - Colors on `Console`
   - Not on `File`
- [x] Mutable levels on `info` objects 
   – Use `triple-beam` and `Symbol.for('level')`.
   - Needed for `winston.formats.colorize()`. 
- [x] Quieter finalized output using `Symbol.for('message')` 
- [x] Filtering messages completely in a format.
- [x] `winston.format.padLevels()` format.
- [x] `humanReadableUnhandledException` should be the default

### Communications / Compatibility
- [x] Add friendly(ish) deprecation notices for common changes.
- [x] Create `winston-compat` to help with backwards compatibility for transport authors.  
- [x] Update the `README.md` in `winston`.
- [x] `README.md` for `winston-transport`.
- [x] `README.md` for `logform`.
- [x] Migrate all `examples/*.js` to the new API.

### Querying, Streaming, Uncaught Exceptions
- [x] Uncaught Exceptions

### Other Miscellaneous API changes
- [x] Move `LogStream` back to `Logger`.
- [x] Add LogStream.prototype.configure from `winston@2.0.0`
- [x] `winston.Container` instances no longer add any transports by default.
- [x] Strip wrapping `(` `)` from all occurances of `new winston.transports.*)`

### Benchmarking
- [x] Benchmark against `winston@1.0.0` in `logmark`.
- [x] Benchmark against `winston@2.0.0` in `logmark`.
- [x] Benchmark JSON format against `bunyan` in `logmark`.
- [x] Benchmark against `pino` in `logmark`.
- [x] Submit PR for all `pino` benchmarks.


================================================
FILE: docs/transports.md
================================================
# Winston Transports

In `winston` a transport is essentially a storage device for your logs. Each
instance of a winston logger can have multiple transports configured at
different levels. For example, one may want error logs to be stored in a
persistent remote location (like a database), but all logs output to the
console or a local file.

There are several [core transports](#built-in-to-winston) included in `winston`
that leverage the built-in networking and file I/O offered by Node.js core. In
addition, there are transports which are [actively supported by winston
contributors](#maintained-by-winston-contributors). And last (but not least)
there are additional transports written by
[members of the community](#community-transports).

> Additionally there are transports previously maintained by winston
> contributors that are [looking for maintainers](#looking-for-maintainers).

* **[Built-in to winston](#built-in-to-winston)**
  * [Console](#console-transport)
  * [File](#file-transport)
  * [Http](#http-transport)
  * [Stream](#stream-transport)

* **[Maintained by winston contributors](#maintained-by-winston-contributors)**
  * [DailyRotateFile](#dailyrotatefile-transport)
  * [MongoDB](#mongodb-transport)
  * [Syslog](#syslog-transport)

* **[Community Transports](#community-transports)**
  * [Airbrake](#airbrake-transport)
  * [Amazon CloudWatch](#amazon-cloudwatch-transport)
  * [Amazon DynamoDB](#amazon-dynamodb-transport)
  * [Amazon Kinesis Firehose](#amazon-kinesis-firehose-transport)
  * [Amazon SNS](#amazon-sns-simple-notification-system-transport)
  * [Azure Table](#azure-table)
  * [Cassandra](#cassandra-transport)
  * [Cisco Spark](#cisco-spark-transport)
  * [Cloudant](#cloudant)
  * [Datadog](#datadog-transport)
  * [Elasticsearch](#elasticsearch-transport)
  * [FastFileRotate](#fastfilerotate-transport)
  * [Google BigQuery](#google-bigquery)
  * [Google Stackdriver Logging](#google-stackdriver-transport)
  * [Graylog2](#graylog2-transport)
  * [Humio](#humio-transport)
  * [LogDNA](#logdna-transport)
  * [Logsene](#logsene-transport) (including Log-Alerts and Anomaly Detection)
  * [Logz.io](#logzio-transport)
  * [Mail](#mail-transport)
  * [MySQL](#mysql-transport)
  * [New Relic](#new-relic-agent-transport)
  * [Papertrail](#papertrail-transport)
  * [Parseable](#parseable)
  * [PostgresQL](#postgresql-transport)
  * [Pusher](#pusher-transport)
  * [Sentry](#sentry-transport)
  * [Seq](#seq-transport)
  * [SimpleDB](#simpledb-transport)
  * [Slack](#slack-transport)
  * [SQLite3](#sqlite3-transport)
  * [SSE with KOA 2](#sse-transport-with-koa-2)
  * [Sumo Logic](#sumo-logic-transport)
  * [VS Code extension](#vs-code-extension)
  * [Worker Thread based async Console transport](#worker-thread-based-async-console-transport)
  * [Winlog2 Transport](#winlog2-transport)

* **[Looking for maintainers](#looking-for-maintainers)**
  * [CouchDB](#couchdb-transport)
  * [Loggly](#loggly-transport)
  * [Redis](#redis-transport)
  * [Riak](#riak-transport)

## Built-in to winston

There are several core transports included in `winston`, which leverage the built-in networking and file I/O offered by Node.js core.

* [Console](#console-transport)
* [File](#file-transport)
* [Http](#http-transport)
* [Stream](#stream-transport)

### Console Transport

``` js
logger.add(new winston.transports.Console(options));
```

The Console transport takes a few simple options:

* __level:__ Level of messages that this transport should log (default: level set on parent logger).
* __silent:__ Boolean flag indicating whether to suppress output (default false).
* __eol:__ string indicating the end-of-line characters to use (default `os.EOL`)
* __stderrLevels__ Array of strings containing the levels to log to stderr instead of stdout, for example `['error', 'debug', 'info']`. (default `[]`)
* __consoleWarnLevels__ Array of strings containing the levels to log using console.warn or to stderr (in Node.js) instead of stdout, for example `['warn', 'debug']`. (default `[]`)

### File Transport
``` js
logger.add(new winston.transports.File(options));
```

The File transport supports a variety of file writing options. If you are
looking for daily log rotation see [DailyRotateFile](#dailyrotatefile-transport)

* __level:__ Level of messages that this transport should log (default: level set on parent logger).
* __silent:__ Boolean flag indicating whether to suppress output (default false).
* __eol:__ Line-ending character to use. (default: `os.EOL`).
* __lazy:__ If true, log files will be created on demand, not at the initialization time.
* __filename:__ The filename of the logfile to write output to.
* __maxsize:__ Max size in bytes of the logfile, if the size is exceeded then a new file is created, a counter will become a suffix of the log file.
* __maxFiles:__ Limit the number of files created when the size of the logfile is exceeded.
* __tailable:__ If true, log files will be rolled based on maxsize and maxfiles, but in ascending order. The __filename__ will always have the most recent log lines. The larger the appended number, the older the log file.  This option requires __maxFiles__ to be set, or it will be ignored.
* __maxRetries:__ The number of stream creation retry attempts before entering a failed state. In a failed state the transport stays active but performs a NOOP on it's log function. (default 2)
* __zippedArchive:__ If true, all log files but the current one will be zipped.
* __options:__ options passed to `fs.createWriteStream` (default `{flags: 'a'}`).
* __stream:__ **DEPRECATED** The WriteableStream to write output to.

### Http Transport

``` js
logger.add(new winston.transports.Http(options));
```

The `Http` transport is a generic way to log, query, and stream logs from an arbitrary Http endpoint, preferably [winstond][1]. It takes options that are passed to the node.js `http` or `https` request:

* __host:__ (Default: **localhost**) Remote host of the HTTP logging endpoint
* __port:__ (Default: **80 or 443**) Remote port of the HTTP logging endpoint
* __path:__ (Default: **/**) Remote URI of the HTTP logging endpoint
* __auth:__ (Default: **None**) An object representing the `username` and `password` for HTTP Basic Auth
* __ssl:__ (Default: **false**) Value indicating if we should use HTTPS
* __batch:__ (Default: **false**) Value indicating if batch mode should be used. A batch of logs to send through the HTTP request when one of the batch options is reached: number of elements, or timeout
* __batchInterval:__ (Default: **5000 ms**) Value indicating the number of milliseconds to wait before sending the HTTP request
* __batchCount:__ (Default: **10**) Value indicating the number of logs to cumulate before sending the HTTP request

### Stream Transport

``` js
logger.add(new winston.transports.Stream({
  stream: fs.createWriteStream('/dev/null')
  /* other options */
}));
```

The Stream transport takes a few simple options:

* __stream:__ any Node.js stream. If an `objectMode` stream is provided then
  the entire `info` object will be written. Otherwise `info[MESSAGE]` will be
  written.
* __level:__ Level of messages that this transport should log (default: level set on parent logger).
* __silent:__ Boolean flag indicating whether to suppress output (default false).
* __eol:__ Line-ending character to use. (default: `os.EOL`).

## Maintained by winston contributors

Starting with `winston@0.3.0` an effort was made to remove any transport which added additional dependencies to `winston`. At the time there were several transports already in `winston` which will have slowly waned in usage. The
following transports are **actively maintained by members of the winston Github
organization.**

* [MongoDB](#mongodb-transport)
* [DailyRotateFile](#dailyrotatefile-transport)
* [Syslog](#syslog-transport)

### MongoDB Transport

As of `winston@0.3.0` the MongoDB transport has been broken out into a new module: [winston-mongodb][14]. Using it is just as easy:

``` js
const winston = require('winston');

/**
 * Requiring `winston-mongodb` will expose
 * `winston.transports.MongoDB`
 */
require('winston-mongodb');

logger.add(new winston.transports.MongoDB(options));
```

The MongoDB transport takes the following options. 'db' is required:

* __level:__ Level of messages that this transport should log, defaults to
'info'.
* __silent:__ Boolean flag indicating whether to suppress output, defaults to
false.
* __db:__ MongoDB connection uri, pre-connected db object or promise object
which will be resolved with pre-connected db object.
* __options:__ MongoDB connection parameters (optional, defaults to
`{poolSize: 2, autoReconnect: true}`).
* __collection__: The name of the collection you want to store log messages in,
defaults to 'log'.
* __storeHost:__ Boolean indicating if you want to store machine hostname in
logs entry, if set to true it populates MongoDB entry with 'hostname' field,
which stores os.hostname() value.
* __username:__ The username to use when logging into MongoDB.
* __password:__ The password to use when logging into MongoDB. If you don't
supply a username and password it will not use MongoDB authentication.
* __label:__ Label stored with entry object if defined.
* __name:__ Transport instance identifier. Useful if you need to create multiple
MongoDB transports.
* __capped:__ In case this property is true, winston-mongodb will try to create
new log collection as capped, defaults to false.
* __cappedSize:__ Size of logs capped collection in bytes, defaults to 10000000.
* __cappedMax:__ Size of logs capped collection in number of documents.
* __tryReconnect:__ Will try to reconnect to the database in case of fail during
initialization. Works only if __db__ is a string. Defaults to false.
* __expireAfterSeconds:__ Seconds before the entry is removed. Works only if __capped__ is not set.

*Metadata:* Logged as a native JSON object in 'meta' property.

*Logging unhandled exceptions:* For logging unhandled exceptions specify
winston-mongodb as `handleExceptions` logger according to winston documentation.

### DailyRotateFile Transport

See [winston-dailyrotatefile](https://github.com/winstonjs/winston-daily-rotate-file).

### Syslog Transport

See [winston-syslog](https://github.com/winstonjs/winston-syslog).

## Community Transports

The community has truly embraced `winston`; there are over **23** winston transports and over half of them are maintained by authors external to the winston core team. If you want to check them all out, just search `npm`:

``` bash
  $ npm search winston
```

**If you have an issue using one of these modules you should contact the module author directly**

### Airbrake Transport

[winston-airbrake2][22] is a transport for winston that sends your logs to Airbrake.io.

``` js
const winston = require('winston');
const { Airbrake } = require('winston-airbrake2');
logger.add(new Airbrake(options));
```

The Airbrake transport utilises the node-airbrake module to send logs to the Airbrake.io API. You can set the following options:

* __apiKey__: The project API Key. (required, default: null)
* __name__: Transport name. (optional, default: 'airbrake')
* __level__: The level of message that will be sent to Airbrake (optional, default: 'error')
* __host__: The information that is displayed within the URL of the Airbrake interface. (optional, default: 'http://' + os.hostname())
* __env__: The environment will dictate what happens with your message. If your environment is currently one of the 'developmentEnvironments', the error will not be sent to Airbrake. (optional, default: process.env.NODE_ENV)
* __timeout__: The maximum time allowed to send to Airbrake in milliseconds. (optional, default: 30000)
* __developmentEnvironments__: The environments that will **not** send errors to Airbrake. (optional, default: ['development', 'test'])
* __projectRoot__: Extra string sent to Airbrake. (optional, default: null)
* __appVersion__: Extra string or number sent to Airbrake. (optional, default: null)
* __consoleLogError__: Toggle the logging of errors to console when the current environment is in the developmentEnvironments array. (optional, default: false)

### Amazon CloudWatch Transport

The [winston-aws-cloudwatch][25] transport relays your log messages to Amazon CloudWatch.

```js
const winston = require('winston');
const AwsCloudWatch = require('winston-aws-cloudwatch');

logger.add(new AwsCloudWatch(options));
```

Options:

* __logGroupName:__ The name of the CloudWatch log group to which to log. *[required]*
* __logStreamName:__ The name of the CloudWatch log stream to which to log. *[required]*
* __awsConfig:__ An object containing your `accessKeyId`, `secretAccessKey`, `region`, etc.

~~Alternatively, you may be interested in [winston-cloudwatch][26].~~
`lazywithclass/winston-cloudwatch` is no longer maintained. Use
[@initd-sg/winston-cloudwatch](https://github.com/initdsg/winston-cloudwatch)

### Amazon DynamoDB Transport
The [winston-dynamodb][36] transport uses Amazon's DynamoDB as a sink for log messages. You can take advantage of the various authentication methods supports by Amazon's aws-sdk module. See [Configuring the SDK in Node.js](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html).

``` js
const winston = require('winston');
const { DynamoDB } = require('winston-dynamodb');

logger.add(new DynamoDB(options));
```

Options:
* __accessKeyId:__ your AWS access key id
* __secretAccessKey:__ your AWS secret access key
* __region:__ the region where the domain is hosted
* __useEnvironment:__ use process.env values for AWS access, secret, & region.
* __tableName:__ DynamoDB table name

To Configure using environment authentication:
``` js
logger.add(new winston.transports.DynamoDB({
  useEnvironment: true,
  tableName: 'log'
}));
```

Also supports callbacks for completion when the DynamoDB putItem has been completed.

### Amazon Kinesis Firehose Transport

The [winston-firehose][28] transport relays your log messages to Amazon Kinesis Firehose.

```js
const winston = require('winston');
const WFirehose = require('winston-firehose');

logger.add(new WFirehose(options));
```

Options:

* __streamName:__ The name of the Amazon Kinesis Firehose stream to which to log. *[required]*
* __firehoseOptions:__ The AWS Kinesis firehose options to pass direction to the firehose client, [as documented by AWS](http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Firehose.html#constructor-property). *[required]*

### Amazon SNS (Simple Notification System) Transport

The [winston-sns][18] transport uses amazon SNS to send emails, texts, or a bunch of other notifications. Since this transport uses the Amazon AWS SDK for JavaScript, you can take advantage of the various methods of authentication found in Amazon's [Configuring the SDK in Node.js](http://docs.aws.amazon.com/AWSJavaScriptSDK/guide/node-configuring.html) document.

``` js
const winston = require('winston');
const SnsTransport = require('winston-sns');

logger.add(new SnsTransport(options));
```

Options:

* __subscriber:__ Subscriber number - found in your SNS AWS Console, after clicking on a topic. Same as AWS Account ID. *[required]*
* __topic_arn:__ Also found in SNS AWS Console - listed under a topic as Topic ARN. *[required]*
* __aws_key:__ Your Amazon Web Services Key.
* __aws_secret:__ Your Amazon Web Services Secret.
* __region:__ AWS Region to use. Can be one of: `us-east-1`,`us-west-1`,`eu-west-1`,`ap-southeast-1`,`ap-northeast-1`,`us-gov-west-1`,`sa-east-1`. (default: `us-east-1`)
* __subject:__ Subject for notifications. Uses placeholders for level (%l), error message (%e), and metadata (%m). (default: "Winston Error Report")
* __message:__ Message of notifications. Uses placeholders for level (%l), error message (%e), and metadata (%m). (default: "Level '%l' Error:\n%e\n\nMetadata:\n%m")
* __level:__ lowest level this transport will log. (default: `info`)
* __json:__ use json instead of a prettier (human friendly) string for meta information in the notification. (default: `false`)
* __handleExceptions:__ set to true to have this transport handle exceptions. (default: `false`)

### Azure Table

[winston-azuretable][21] is a Azure Table transport:

``` js
const { AzureLogger } = require('winston-azuretable');
logger.add(new AzureLogger(options));
```

The Azure Table transport connects to an Azure Storage Account using the following options:

* __useDevStorage__: Boolean flag denoting whether to use the Azure Storage Emulator (default: `false`)
* __account__: Azure Storage Account Name. In lieu of this setting, you can set the environment variable: `AZURE_STORAGE_ACCOUNT`
* __key__: Azure Storage Account Key. In lieu of this setting, you can set the environment variable: `AZURE_STORAGE_ACCESS_KEY`
* __level__: lowest logging level transport to be logged (default: `info`)
* __tableName__: name of the table to log messages (default: `log`)
* __partitionKey__: table partition key to use (default: `process.env.NODE_ENV`)
* __silent__: Boolean flag indicating whether to suppress output (default: `false`)

### Cassandra Transport

[winston-cassandra][20] is a Cassandra transport:

``` js
const Cassandra = require('winston-cassandra').Cassandra;
logger.add(new Cassandra(options));
```

The Cassandra transport connects to a cluster using the native protocol with the following options:

* __level:__ Level of messages that this transport should log (default: `'info'`).
* __table:__ The name of the Cassandra column family you want to store log messages in (default: `'logs'`).
* __partitionBy:__ How you want the logs to be partitioned. Possible values `'hour'` and `'day'`(Default).
* __consistency:__ The consistency of the insert query (default: `quorum`).

In addition to the options accepted by the [Node.js Cassandra driver](https://github.com/jorgebay/node-cassandra-cql) Client.

* __hosts:__ Cluster nodes that will handle the write requests:
Array of strings containing the hosts, for example `['host1', 'host2']` (required).
* __keyspace:__ The name of the keyspace that will contain the logs table (required). The keyspace should be already created in the cluster.

### Cisco Spark Transport

[winston-spark][31] is a transport for [Cisco Spark](https://www.ciscospark.com/)

``` js
const winston = require('winston');
require('winston-spark');

const options = {
  accessToken: '***Your Spark Access Token***',
  roomId: '***Spark Room Id***'
};

logger.add(new winston.transports.SparkLogger(options));
```

Valid Options are as the following:
* __accessToken__ Your Spark Access Token. *[required]*
* __roomId__ Spark Room Id. *[required]*
* __level__ Log Level (default: info)
* __hideMeta__ Hide MetaData (default: false)

### Cloudant
[winston-clodant][34] is a transport for Cloudant NoSQL Db.

```js
const winston = require('winston');
const WinstonCloudant = require('winston-cloudant');
logger.add(new WinstonCloudant(options));
```

The Cloudant transport takes the following options:

    url         : Access url including user and password [required]
    username    : Username for the Cloudant DB instance
    password    : Password for the Cloudant DB instance
    host        : Host for the Cloudant DB instance
    db          : Name of the databasename to put logs in
    logstash    : Write logs in logstash format

### Datadog Transport
[datadog-logger-integrations][38] is a transport to ship your logs to DataDog.

```javascript
var winston = require('winston')
var { DataDogTransport } = require('datadog-logger-integrations/winston')

var logger = winston.createLogger({
  // Whatever options you need
  // Refer https://github.com/winstonjs/winston#creating-your-own-logger
})

logger.add(
  new DataDogTransport({
    ddClientConfig: {
      authMethods: {
        apiKeyAuth: apiKey,
      },
    },
    service: 'super_service',
    ddSource: 'nodejs',
    ddTags: 'foo:bar,boo:baz'
  })
)
```

Options:
* __ddClientConfig__: DataDog client config *[required]*
* __service__: The name of the application or service generating the logs
* __ddsource__: The technology from which the logs originated
* __ddtags__: Metadata associated with the logs

### Google BigQuery
[winston-bigquery][42] is a transport for Google BigQuery.

```js
import {WinstonBigQuery} from 'winston-bigquery';
import winston, {format} from 'winston';

const logger = winston.createLogger({
	transports: [
		new WinstonBigQuery({
			tableId: 'winston_logs',
			datasetId: 'logs'
		})
	]
});
```

The Google BigQuery takes the following options:

* __datasetId__   	      	    : Your dataset name [required]
* __tableId__     	  	    : Table name in the datase [required]
* __applicationCredentials__    : a path to local service worker (useful in dev env) [Optional]

**Pay Attention**, since BQ, unlike some other products, is not a "schema-less" you will need to build the schema in advance.
read more on the topic on [github][42] or [npmjs.com][43]

### Google Stackdriver Transport

[@google-cloud/logging-winston][29] provides a transport to relay your log messages to [Stackdriver Logging][30].

```js
const winston = require('winston');
const Stackdriver = require('@google-cloud/logging-winston');
logger.add(new Stackdriver({
  projectId: 'your-project-id',
  keyFilename: '/path/to/keyfile.json'
}));
```

### Graylog2 Transport

[winston-graylog2][19] is a Graylog2 transport:

``` js
const winston = require('winston');
const Graylog2 = require('winston-graylog2');
logger.add(new Graylog2(options));
```

The Graylog2 transport connects to a Graylog2 server over UDP using the following options:

* __name__:  Transport name
* __level__: Level of messages this transport should log. (default: info)
* __silent__: Boolean flag indicating whether to suppress output. (default: false)
* __handleExceptions__: Boolean flag, whenever to handle uncaught exceptions. (default: false)
* __graylog__:
  - __servers__; list of graylog2 servers
    * __host__: your server address (default: localhost)
    * __port__: your server port (default: 12201)
  - __hostname__: the name of this host (default: os.hostname())
  - __facility__: the facility for these log messages (default: "Node.js")
  - __bufferSize__: max UDP packet size, should never exceed the MTU of your system (default: 1400)

### Elasticsearch Transport

Log to Elasticsearch in a logstash-like format and
leverage Kibana to browse your logs.

See: https://github.com/vanthome/winston-elasticsearch.

### FastFileRotate Transport

[fast-file-rotate][35] is a performant file transport providing daily log rotation.

```js
const FileRotateTransport = require('fast-file-rotate');
const winston = require('winston');

const logger = winston.createLogger({
  transports: [
    new FileRotateTransport({
      fileName: __dirname + '/console%DATE%.log'
    })
  ]
})
```

### Humio Transport

[humio-winston][44] is a transport for sending logs to Humio:

``` js
const winston = require('winston');
const HumioTransport = require('humio-winston');

const logger = winston.createLogger({
  transports: [
    new HumioTransport({
      ingestToken: '<YOUR HUMIO INGEST TOKEN>',
    }),
  ],
});
```

### LogDNA Transport

[LogDNA Winston][37] is a transport for being able to forward the logs to [LogDNA](https://logdna.com/):

``` js
const logdnaWinston = require('logdna-winston');
const winston = require('winston');
const logger = winston.createLogger({});
const options = {
    key: apikey, // the only field required
    hostname: myHostname,
    ip: ipAddress,
    mac: macAddress,
    app: appName,
    env: envName,
    index_meta: true // Defaults to false, when true ensures meta object will be searchable
};

// Only add this line in order to track exceptions
options.handleExceptions = true;

logger.add(new logdnaWinston(options));

let meta = {
    data:'Some information'
};
logger.log('info', 'Log from LogDNA Winston', meta);
```

### Logzio Transport

You can download the logzio transport here : [https://github.com/logzio/winston-logzio](https://github.com/logzio/winston-logzio)

*Basic Usage*
```js
const winston = require('winston');
const Logzio = require('winston-logzio');

logger.add(new Logzio({
  token: '__YOUR_API_TOKEN__'
}));
```

For more information about how to configure the logzio transport, view the README.md in the [winston-logzio repo](https://github.com/logzio/winston-logzio).

### Logsene Transport

[winston-logsene][24] transport for Elasticsearch bulk indexing via HTTPS to Logsene:

``` js
const winston = require('winston');
const Logsene = require('winston-logsene');

logger.add(new Logsene({
  token: process.env.LOGSENE_TOKEN
  /* other options */
}));
```
Options:
* __token__: Logsene Application Token
* __source__: Source of the logs (defaults to main module)

[Logsene](http://www.sematext.com/logsene/) features:
- Fulltext search
- Anomaly detection and alerts
- Kibana4 integration
- Integration with [SPM Performance Monitoring for Node.js](http://www.sematext.com/spm/integrations/nodejs-monitoring.html)

### Mail Transport

The [winston-mail][16] is an email transport:

``` js
const { Mail } = require('winston-mail');
logger.add(new Mail(options));
```

The Mail transport uses [node-mail][17] behind the scenes.  Options are the following, `to` and `host` are required:

* __to:__ The address(es) you want to send to. *[required]*
* __from:__ The address you want to send from. (default: `winston@[server-host-name]`)
* __host:__ SMTP server hostname
* __port:__ SMTP port (default: 587 or 25)
* __secure:__ Use secure
* __username__ User for server auth
* __password__ Password for server auth
* __level:__ Level of messages that this transport should log.
* __silent:__ Boolean flag indicating whether to suppress output.

*Metadata:* Stringified as JSON in email.

### MySQL Transport

[winston-mysql](https://github.com/charles-zh/winston-mysql) is a MySQL transport for Winston.

Create a table in your database first:

```sql
 CREATE TABLE `sys_logs_default` (
 `id` INT NOT NULL AUTO_INCREMENT,
 `level` VARCHAR(16) NOT NULL,
 `message` VARCHAR(2048) NOT NULL,
 `meta` VARCHAR(2048) NOT NULL,
 `timestamp` DATETIME NOT NULL,
 PRIMARY KEY (`id`));
```

> You can also specify `meta` to be a `JSON` field on MySQL 5.7+, i.e., ``meta` JSON NOT NULL`, which is helfpul for searching and parsing.

Configure Winston with the transport:

```javascript
import MySQLTransport from 'winston-mysql';

const options = {
    host: '${MYSQL_HOST}',
    user: '${MYSQL_USER}',
    password: '${MYSQL_PASSWORD}',
    database: '${MYSQL_DATABASE}',
    table: 'sys_logs_default'
};

const logger = winston.createLogger({
    level: 'debug',
    format: winston.format.json(),
    defaultMeta: { service: 'user-service' },
    transports: [
        new winston.transports.Console({
            format: winston.format.simple(),
        }),
        new MySQLTransport(options),
    ],
});

/// ...
let msg = 'My Log';
logger.info(msg, {message: msg, type: 'demo'});
```


### New Relic Agent Transport

[winston-newrelic-agent-transport][47] is a New Relic transport that leverages the New Relic agent:

``` js
import winston from 'winston'
import NewrelicTransport from 'winston-newrelic-agent-transport'

const logger = winston.createLogger()

const options = {}
logger.add(new NewrelicTransport(options))
```

The New Relic agent typically automatically forwards Winston logs to New Relic when using CommonJS. With CommonJS no additional transport should be needed. However, when using ECMAScript modules, the automatic forwarding of logs can with certain coding patterns not work. If the New Relic agent is not automatically forwarding your logs, this transport provides a solution.

Options:

* __level__ (optional): The Winston logging level to use as the maximum level of messages that the transport will log.
* __rejectCriteria__ (optional): The rejectCriteria option allows you to specify an array of regexes that will be matched against either the Winston info object or log message to determine whether or not a log message should be rejected and not logged to New Relic.

### Papertrail Transport

[winston-papertrail][27] is a Papertrail transport:

``` js
const { Papertrail } = require('winston-papertrail');
logger.add(new Papertrail(options));
```

The Papertrail transport connects to a [PapertrailApp log destination](https://papertrailapp.com) over TCP (TLS) using the following options:

* __level:__ Level of messages this transport should log. (default: info)
* __host:__ FQDN or IP address of the Papertrail endpoint.
* __port:__ Port for the Papertrail log destination.
* __hostname:__ The hostname associated with messages. (default: require('os').hostname())
* __program:__ The facility to send log messages.. (default: default)
* __logFormat:__ a log formatting function with the signature `function(level, message)`, which allows custom formatting of the level or message prior to delivery

*Metadata:* Logged as a native JSON object to the 'meta' attribute of the item.

### Parseable Transport

[Parseable](https://parseable.com/) is an open source, general purpose log analytics system. [Parseable-Winston](https://github.com/jybleau/parseable-node-loggers/tree/main/packages/winston#parseable-winston) is a Parseable transport for Winston.

```js
// Using cjs
const { ParseableTransport } = require('parseable-winston')
const winston = require('winston')

const parseable = new ParseableTransport({
  url: process.env.PARSEABLE_LOGS_URL, // Ex: 'https://parsable.myserver.local/api/v1/logstream'
  username: process.env.PARSEABLE_LOGS_USERNAME,
  password: process.env.PARSEABLE_LOGS_PASSWORD,
  logstream: process.env.PARSEABLE_LOGS_LOGSTREAM, // The logstream name
  tags: { tag1: 'tagValue' } // optional tags to be added with each ingestion
})

const logger = winston.createLogger({
  levels: winston.config.syslog.levels,
  transports: [parseable],
  defaultMeta: { instance: 'app', hostname: 'app1' }
})

logger.info('User took the goggles', { userid: 1, user: { name: 'Rainier Wolfcastle' } })
logger.warning('The goggles do nothing', { userid: 1 })
```

### PostgresQL Transport

[@pauleliet/winston-pg-native](https://github.com/petpano/winston-pg-native) is a PostgresQL transport supporting Winston 3.X.

### Pusher Transport
[winston-pusher](https://github.com/meletisf/winston-pusher) is a Pusher transport.

```js
const { PusherLogger } = require('winston-pusher');
logger.add(new PusherLogger(options));
```

This transport sends the logs to a Pusher app for real time processing and it uses the following options:

* __pusher__ [Object]
  * __appId__ The application id obtained from the dashboard
  * __key__ The application key obtained from the dashboard
  * __secret__ The application secret obtained from the dashboard
  * __cluster__ The cluster
  * __encrypted__ Whether the data will be send through SSL
* __channel__ The channel of the event (default: default)
* __event__ The event name (default: default)

### Sentry Transport
[winston-transport-sentry-node][41] is a transport for [Sentry](https://sentry.io/) uses [@sentry/node](https://www.npmjs.com/package/@sentry/node).

```js
const Sentry = require('winston-transport-sentry-node').default;
logger.add(new Sentry({
  sentry: {
    dsn: 'https://******@sentry.io/12345',
  },
  level: 'info'
}));
```

This transport takes the following options:

* __sentry:__ [Object]
  * __dsn:__ Sentry DSN or Data Source Name (default: `process.env.SENTRY_DSN`) **REQUIRED**
  * __environment:__ The application environment (default: `process.env.SENTRY_ENVIRONMENT || process.env.NODE_ENV || 'production'`)
  * __serverName:__  The application name
  * __debug:__ Turns debug mode on or off (default: `process.env.SENTRY_DEBUG || false`)
  * __sampleRate:__ Sample rate as a percentage of events to be sent in the range of 0.0 to 1.0 (default: `1.0`)
  * __maxBreadcrumbs:__ Total amount of breadcrumbs that should be captured (default: `100`)
* __level:__ Level of messages that this transport should log
* __silent:__  Boolean flag indicating whether to suppress output, defaults to false

### Seq Transport

[winston-seq][45] is a transport that sends structured log events to [Seq](https://datalust.co/seq).

```js
const { SeqTransport } = require('@datalust/winston-seq');
logger.add(new SeqTransport({
  serverUrl: "https://your-seq-server:5341",
  apiKey: "your-api-key",
  onError: (e => { console.error(e) }),
}));
```

`SeqTransport` is configured with the following options:

* __serverUrl__ - the URL for your Seq server's ingestion
* __apiKey__ - (optional) The Seq API Key to use
* __onError__ - Callback to execute when an error occurs within the transport

### SimpleDB Transport

The [winston-simpledb][15] transport is just as easy:

``` js
const SimpleDB = require('winston-simpledb').SimpleDB;
logger.add(new SimpleDB(options));
```

The SimpleDB transport takes the following options. All items marked with an asterisk are required:

* __awsAccessKey__:* your AWS Access Key
* __secretAccessKey__:* your AWS Secret Access Key
* __awsAccountId__:* your AWS Account Id
* __domainName__:* a string or function that returns the domain name to log to
* __region__:* the region your domain resides in
* __itemName__: a string ('uuid', 'epoch', 'timestamp') or function that returns the item name to log

*Metadata:* Logged as a native JSON object to the 'meta' attribute of the item.

### Slack Transport
[winston-slack-webhook-transport][39] is a transport that sends all log messages to the Slack chat service.

```js
const winston = require('winston');
const SlackHook = require('winston-slack-webhook-transport');

const logger = winston.createLogger({
	level: 'info',
	transports: [
		new SlackHook({
			webhookUrl: 'https://hooks.slack.com/services/xxx/xxx/xxx'
		})
	]
});

logger.info('This should now appear on Slack');
```

This transport takes the following options:

* __webhookUrl__ - Slack incoming webhook URL. This can be from a basic integration or a bot. **REQUIRED**
* __channel__ - Slack channel to post message to.
* __username__ - Username to post message with.
* __iconEmoji__ - Status icon to post message with. (interchangeable with __iconUrl__)
* __iconUrl__ - Status icon to post message with. (interchangeable with __iconEmoji__)
* __formatter__ - Custom function to format messages with. This function accepts the __info__ object ([see Winston documentation](https://github.com/winstonjs/winston/blob/master/README.md#streams-objectmode-and-info-objects)) and must return an object with at least one of the following three keys: __text__ (string), __attachments__ (array of [attachment objects](https://api.slack.com/docs/message-attachments)), __blocks__ (array of [layout block objects](https://api.slack.com/messaging/composing/layouts)). These will be used to structure the format of the logged Slack message. By default, messages will use the format of `[level]: [message]` with no attachments or layout blocks.
* __level__ - Level to log. Global settings will apply if this is blank.
* __unfurlLinks__ - Enables or disables [link unfurling.](https://api.slack.com/docs/message-attachments#unfurling) (Default: false)
* __unfurlMedia__ - Enables or disables [media unfurling.](https://api.slack.com/docs/message-link-unfurling) (Default: false)
* __mrkdwn__ - Enables or disables [`mrkdwn` formatting](https://api.slack.com/messaging/composing/formatting#basics) within attachments or layout blocks (Default: false)

### SQLite3 Transport

The [winston-better-sqlite3][40] transport uses [better-sqlite3](https://github.com/JoshuaWise/better-sqlite3).

```js
const wbs = require('winston-better-sqlite3');
logger.add(new wbs({

    // path to the sqlite3 database file on the disk
    db: '<name of sqlite3 database file>',

    // A list of params to log
    params: ['level', 'message']
}));
```

### Sumo Logic Transport
[winston-sumologic-transport][32] is a transport for Sumo Logic

``` js
const winston = require('winston');
const { SumoLogic } = require('winston-sumologic-transport');

logger.add(new SumoLogic(options));
```

Options:
* __url__: The Sumo Logic HTTP collector URL

### SSE transport with KOA 2
[winston-koa-sse](https://github.com/alexvictoor/winston-koa-sse) is a transport that leverages on Server Sent Event. With this transport you can use your browser console to view your server logs.

### VS Code extension

[winston-transport-vscode][48] is a transport for VS Code extension development.

```js
const vscode = require('vscode');
const winston = require('winston');
const { OutputChannelTransport } = require('winston-transport-vscode');

const outputChannel = vscode.window.createOutputChannel('My extension');

const logger = winston.createLogger({
  transports: [new OutputChannelTransport({ outputChannel })],
});
```

The extension includes dedicated log levels and format for using with VS Code's
LogOutputChannel.

```js
const { LogOutputChannelTransport } = require('winston-transport-vscode');

const outputChannel = vscode.window.createOutputChannel('My extension', {
  log: true,
});

const logger = winston.createLogger({
  levels: LogOutputChannelTransport.config.levels,
  format: LogOutputChannelTransport.format(),
  transports: [new LogOutputChannelTransport({ outputChannel })],
});
```


### Worker Thread based async Console transport

[winston-console-transport-in-worker][46]

```typescript
import * as winston from 'winston';
import { ConsoleTransportInWorker } from '@greeneyesai/winston-console-transport-in-worker';

...

export const logger: winston.Logger = winston.createLogger({
    format: combine(timestamp(), myFormat),
    level: Level.INFO,
    transports: [new ConsoleTransportInWorker()],
});
```

The `ConsoleTransportInWorker` is a subclass of `winston.transports.Console` therefore accepting the same options as the `Console` transport.

TypeScript supported.

### Winlog2 Transport

[winston-winlog2][33] is a Windows Event log transport:

``` js
const winston = require('winston');
const Winlog2 = require('winston-winlog2');
logger.add(new Winlog2(options));
```

The winlog2 transport uses the following options:

* __name__:  Transport name
* __eventLog__: Log type (default: 'APPLICATION')
* __source__: Name of application which will appear in event log (default: 'node')

## Looking for maintainers

These transports are part of the `winston` Github organization but are
actively seeking new maintainers. Interested in getting involved? Open an
issue on `winston` to get the conversation started!

* [CouchDB](#couchdb-transport)
* [Loggly](#loggly-transport)
* [Redis](#redis-transport)
* [Riak](#riak-transport)

### CouchDB Transport

_As of `winston@0.6.0` the CouchDB transport has been broken out into a new module: [winston-couchdb][2]._

``` js
const WinstonCouchDb = require('winston-couchdb');
logger.add(new WinstonCouchdb(options));
```

The `Couchdb` will place your logs in a remote CouchDB database. It will also create a [Design Document][3], `_design/Logs` for later querying and streaming your logs from CouchDB. The transport takes the following options:

* __host:__ (Default: **localhost**) Remote host of the HTTP logging endpoint
* __port:__ (Default: **5984**) Remote port of the HTTP logging endpoint
* __db:__ (Default: **winston**) Remote URI of the HTTP logging endpoint
* __auth:__ (Default: **None**) An object representing the `username` and `password` for HTTP Basic Auth
* __ssl:__ (Default: **false**) Value indicating if we should us HTTPS

### Loggly Transport

_As of `winston@0.6.0` the Loggly transport has been broken out into a new module: [winston-loggly][5]._

``` js
const WinstonLoggly = require('winston-loggly');
logger.add(new winston.transports.Loggly(options));
```

The Loggly transport is based on [Nodejitsu's][6] [node-loggly][7] implementation of the [Loggly][8] API. If you haven't heard of Loggly before, you should probably read their [value proposition][9]. The Loggly transport takes the following options. Either 'inputToken' or 'inputName' is required:

* __level:__ Level of messages that this transport should log.
* __subdomain:__ The subdomain of your Loggly account. *[required]*
* __auth__: The authentication information for your Loggly account. *[required with inputName]*
* __inputName:__ The name of the input this instance should log to.
* __inputToken:__ The input token of the input this instance should log to.
* __json:__ If true, messages will be sent to Loggly as JSON.

### Redis Transport

``` js
const WinstonRedis = require('winston-redis');
logger.add(new WinstonRedis(options));
```

This transport accepts the options accepted by the [node-redis][4] client:

* __host:__ (Default **localhost**) Remote host of the Redis server
* __port:__ (Default **6379**) Port the Redis server is running on.
* __auth:__ (Default **None**) Password set on the Redis server

In addition to these, the Redis transport also accepts the following options.

* __length:__ (Default **200**) Number of log messages to store.
* __container:__ (Default **winston**) Name of the Redis container you wish your logs to be in.
* __channel:__ (Default **None**) Name of the Redis channel to stream logs from.

### Riak Transport

_As of `winston@0.3.0` the Riak transport has been broken out into a new module: [winston-riak][11]._ Using it is just as easy:

``` js
const { Riak } = require('winston-riak');
logger.add(new Riak(options));
```

In addition to the options accepted by the [riak-js][12] [client][13], the Riak transport also accepts the following options. It is worth noting that the riak-js debug option is set to *false* by default:

* __level:__ Level of messages that this transport should log.
* __bucket:__ The name of the Riak bucket you wish your logs to be in or a function to generate bucket names dynamically.

``` js
  // Use a single bucket for all your logs
  const singleBucketTransport = new Riak({ bucket: 'some-logs-go-here' });

  // Generate a dynamic bucket based on the date and level
  const dynamicBucketTransport = new Riak({
    bucket: function (level, msg, meta, now) {
      var d = new Date(now);
      return level + [d.getDate(), d.getMonth(), d.getFullYear()].join('-');
    }
  });
```


## Find more Transports

There are more than 1000 packages on `npm` when [you search for] `winston`.
That's why we say it's a logger for just about everything

[you search for]: https://www.npmjs.com/search?q=winston
[0]: https://nodejs.org/api/stream.html#stream_class_stream_writable
[1]: https://github.com/flatiron/winstond
[2]: https://github.com/indexzero/winston-couchdb
[3]: http://guide.couchdb.org/draft/design.html
[4]: https://github.com/mranney/node_redis
[5]: https://github.com/indexzero/winston-loggly
[6]: http://nodejitsu.com
[7]: https://github.com/nodejitsu/node-loggly
[8]: http://loggly.com
[9]: http://www.loggly.com/product/
[10]: http://wiki.loggly.com/loggingfromcode
[11]: https://github.com/indexzero/winston-riak
[12]: http://riakjs.org
[13]: https://github.com/frank06/riak-js/blob/master/src/http_client.coffee#L10
[14]: http://github.com/indexzero/winston-mongodb
[15]: http://github.com/appsattic/winston-simpledb
[16]: http://github.com/wavded/winston-mail
[17]: https://github.com/weaver/node-mail
[18]: https://github.com/jesseditson/winston-sns
[19]: https://github.com/namshi/winston-graylog2
[20]: https://github.com/jorgebay/winston-cassandra
[21]: https://github.com/jpoon/winston-azuretable
[22]: https://github.com/rickcraig/winston-airbrake2
[24]: https://github.com/sematext/winston-logsene
[25]: https://github.com/timdp/winston-aws-cloudwatch
[26]: https://github.com/lazywithclass/winston-cloudwatch
[27]: https://github.com/kenperkins/winston-papertrail
[28]: https://github.com/pkallos/winston-firehose
[29]: https://www.npmjs.com/package/@google-cloud/logging-winston
[30]: https://cloud.google.com/logging/
[31]: https://github.com/joelee/winston-spark
[32]: https://github.com/avens19/winston-sumologic-transport
[33]: https://github.com/peteward44/winston-winlog2
[34]: https://github.com/hakanostrom/winston-cloudant
[35]: https://github.com/SerayaEryn/fast-file-rotate
[36]: https://github.com/inspiredjw/winston-dynamodb
[37]: https://github.com/logdna/logdna-winston
[38]: https://github.com/marklai1998/datadog-logger-integrations
[39]: https://github.com/TheAppleFreak/winston-slack-webhook-transport
[40]: https://github.com/punkish/winston-better-sqlite3
[41]: https://github.com/aandrewww/winston-transport-sentry-node
[42]: https://github.com/kaminskypavel/winston-bigquery
[43]: https://www.npmjs.com/package/winston-bigquery
[44]: https://github.com/Quintinity/humio-winston
[45]: https://github.com/datalust/winston-seq
[46]: https://github.com/arpad1337/winston-console-transport-in-worker
[47]: https://github.com/kimnetics/winston-newrelic-agent-transport
[48]: https://github.com/loderunner/winston-transport-vscode


================================================
FILE: examples/color-message.js
================================================
'use strict';

const winston = require('../');

const logger = module.exports = winston.createLogger({
  transports: [new winston.transports.Console()],
  format: winston.format.combine(
    winston.format.colorize({ all: true }),
    winston.format.simple()
  )
});

logger.log('info', 'This is an information message.');


================================================
FILE: examples/create-file.js
================================================
'use strict';

const fs = require('fs');
const path = require('path');
const winston = require('../lib/winston');

const filename = path.join(__dirname, 'created-logfile.log');

//
// Remove the file, ignoring any errors
//
try { fs.unlinkSync(filename); }
catch (ex) { }

//
// Create a new winston logger instance with two tranports: Console, and File
//
//
const logger = winston.createLogger({
  transports: [
    new winston.transports.Console(),
    new winston.transports.File({ filename })
  ]
});

logger.log('info', 'Hello created log files!', { 'foo': 'bar' });

setTimeout(function () {
  //
  // Remove the file, ignoring any errors
  //
  try { fs.unlinkSync(filename); }
  catch (ex) { }
}, 1000);


================================================
FILE: examples/custom-levels-colors.js
================================================
'use strict';

const winston = require('../lib/winston');

//
// Logging levels
//
const config = {
  levels: {
    error: 0,
    debug: 1,
    warn: 2,
    data: 3,
    info: 4,
    verbose: 5,
    silly: 6,
    custom: 7
  },
  colors: {
    error: 'red',
    debug: 'blue',
    warn: 'yellow',
    data: 'grey',
    info: 'green',
    verbose: 'cyan',
    silly: 'magenta',
    custom: 'yellow'
  }
};

winston.addColors(config.colors);

const logger = module.exports = winston.createLogger({
  levels: config.levels,
  format: winston.format.combine(
    winston.format.colorize(),
    winston.format.simple()
  ),
  transports: [
    new winston.transports.Console()
  ],
  level: 'custom'
});

logger.custom('hello')


================================================
FILE: examples/custom-levels.js
================================================
'use strict';

const winston = require('../');

const myCustomLevels = {
  levels: {
    foo: 0,
    bar: 1,
    baz: 2,
    foobar: 3
  },
  colors: {
    foo: 'blue',
    bar: 'green',
    baz: 'yellow',
    foobar: 'red'
  }
};

const customLevelLogger = winston.createLogger({
  level: 'foobar',
  levels: myCustomLevels.levels,
  transports: [
    new winston.transports.Console()
  ]
});

customLevelLogger.foobar('some foobar level-ed message');
customLevelLogger.baz('some baz level-ed message');
customLevelLogger.bar('some bar level-ed message');
customLevelLogger.foo('some foo level-ed message');


================================================
FILE: examples/custom-pretty-print.js
================================================
'use strict';

const winston = require('../');

const logger = winston.createLogger({
  format: winston.format.printf(info => {
    return JSON.stringify(info)
      .replace(/\{/g, '< wow ')
      .replace(/\:/g, ' such ')
      .replace(/\}/g, ' >')
  }),
  transports: [
    new winston.transports.Console(),
  ]
});

logger.info('Hello, this is a logging event with a custom pretty print',  { 'foo': 'bar' });
logger.info('Hello, this is a logging event with a custom pretty print2', { 'foo': 'bar' });



================================================
FILE: examples/custom-timestamp.js
================================================
const { format, createLogger, transports } = require('../');

const logger = createLogger({
  format: format.combine(
    format.label({ label: '[my-label]' }),
    format.timestamp({
      format: 'YYYY-MM-DD HH:mm:ss'
    }),
    //
    // The simple format outputs
    // `${level}: ${message} ${[Object with everything else]}`
    //
    format.simple()
    //
    // Alternatively you could use this custom printf format if you
    // want to control where the timestamp comes in your final message.
    // Try replacing `format.simple()` above with this:
    //
    // format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
  ),
  transports: [
    new transports.Console()
  ]
});

logger.info('Hello there. How are you?');


================================================
FILE: examples/custom-transport.js
================================================

const { createLogger } = require('../');
const Transport = require('winston-transport');

//
// Inherit from `winston-transport` so you can take advantage
// of the base functionality and `.exceptions.handle()`.
//
class CustomTransport extends Transport {
  constructor(opts) {
    super(opts);

    //
    // Consume any custom options here. e.g.:
    // - Connection information for databases
    // - Authentication information for APIs (e.g. loggly, papertrail,
    //   logentries, etc.).
    //
  }

  log(info, callback) {
    setImmediate(() => {
      this.emit('logged', info);
    });

    // Perform the writing to the remote service

    callback();
  }
};

const transport = new CustomTransport();
transport.on('logged', (info) => {
  // Verification that log was called on your transport
  console.log(`Logging! It's happening!`, info);
});

// Create a logger and consume an instance of your transport
const logger = createLogger({
  transports: [transport]
});

logger.info('hello')


================================================
FILE: examples/delete-level.js
================================================
'use strict';

const { createLogger, format, transports } = require('../');
const { combine, json } = format;

const severityLevelOnly = format(info => {
  info.severityLevel = info.level;
  delete info.level;
  return info;
});

const logger = createLogger({
  format: combine(
    severityLevelOnly(),
    json()
  ),
  transports: [
    new transports.Console(),
  ]
});

logger.info('This will print without { level }',  { 'foo': 'bar' });
logger.info('This will also print without { level }', { 'foo': 'bar' });



================================================
FILE: examples/errors.js
================================================
const { createLogger, format, transports } = require('../');
const { combine, errors, json } = format;

const logger = createLogger({
  format: combine(
    errors({ stack: true }),
    json()
  ),
  transports: [
    new transports.Console(),
  ]
});

logger.warn(new Error('Error passed as info'));
logger.log('error', new Error('Error passed as message'));

logger.warn('Maybe important error: ', new Error('Error passed as meta'));
logger.log('error', 'Important error: ', new Error('Error passed as meta'));

logger.error(new Error('Error as info'));


================================================
FILE: examples/exception.js
================================================
'use strict';

const winston = require('../');

//
// TODO: THIS IS BROKEN & MUST BE FIXED BEFORE 3.0
// This should output what was previously referred to
// as "humanReadableUncaughtExceptions" by default.
//
const logger = winston.createLogger({
  format: winston.format.simple(),
  transports: [
    new winston.transports.Console({ handleExceptions: true })
  ]
});

throw new Error('Hello, winston!');


================================================
FILE: examples/file-maxsize.js
================================================
const path = require('path');
const { MESSAGE } = require('triple-beam');
const winston = require('../');

const logger = winston.createLogger({
  level: 'info',
  format: winston.format.printf(info => `${info.message}`),
  transports: [
    new winston.transports.File({
      filename: path.join(__dirname, 'error.log'),
      level: 'info',
      maxsize: 500
    })
  ]
});

// Write 750 characters
logger.info(`test=${'a'.repeat(245)}`);
logger.info(`test=${'b'.repeat(245)}`);
logger.info(`test=${'c'.repeat(245)}`);

setTimeout(() => {
  logger.info(`test=${'d'.repeat(245)}`);
  logger.info(`test=${'e'.repeat(245)}`);
  logger.info(`test=${'f'.repeat(245)}`);
}, 2000);


================================================
FILE: examples/finish-event.js
================================================
'use strict';

const winston = require('../');

//
// In winston@3.x both the Logger and the Transport are Node.js streams.
// Node.js streams expose a `.end()` method that signals no more data will\
// be written. The `"finish"` event is emitted after `.end()` has been called
// **AND** all data has been flushed (i.e. all your logs have been written).
//
const logger = winston.createLogger({
  transports: [
    new winston.transports.Console()
  ]
});

process.on('exit', function () {
  console.log('Your process is exiting');
});

logger.on('finish', function () {
  console.log('Your logger is done logging');
});

logger.log('info', 'Hello, this is a raw logging event',   { 'foo': 'bar' });
logger.log('info', 'Hello, this is a raw logging event 2', { 'foo': 'bar' });

logger.end();


================================================
FILE: examples/format-dynamic-content.js
================================================
'use strict';

const winston = require('../');

const logger = module.exports = winston.createLogger({
  transports: [new winston.transports.Console()],
  format: winston.format.combine(
    winston.format(function dynamicContent(info, opts) {
      info.message = '[dynamic content] ' + info.message;
      return info;
    })(),
    winston.format.simple()
  )
});

logger.log('info', 'This is an information message.');


================================================
FILE: examples/format-filter.js
================================================
const { createLogger, format, transports } = require('../');

// Ignore log messages if the have { private: true }
const ignorePrivate = format((info, opts) => {
  if (info.private) { return false; }
  return info;
});

const logger = createLogger({
  format: format.combine(
    ignorePrivate(),
    format.json()
  ),
  transports: [new transports.Console()]
});

// Outputs: {"level":"error","message":"Public error to share"}
logger.log({
  level: 'error',
  message: 'Public error to share'
});

// Messages with { private: true } will not be written when logged.
logger.log({
  private: true,
  level: 'error',
  message: 'This is super secret - hide it.'
});


================================================
FILE: examples/format-logger-and-transport.js
================================================
const fs = require('fs');
const winston = require('../');
const { createLogger, format, transports } = winston;

const logger = createLogger({
  format: format.combine(
    format.timestamp(),
    format.simple()
  ),
  transports: [
    new transports.Console({
      format: format.combine(
        format.timestamp(),
        format.colorize(),
        format.simple()
      )
    }),
    new transports.Stream({
      stream: fs.createWriteStream('./example.log')
    })
  ]
})

logger.log({
  level: 'info',
  message: 'Check example.log – it will have no colors!'
});


================================================
FILE: examples/format-mutate.js
================================================
'use strict';

const winston = require('../');

/*
 * Simple string mask. For example purposes only.
 */
function maskCardNumbers(num) {
  const str = num.toString();
  const { length } = str;

  return Array.from(str, (n, i) => {
    return i < length - 4 ? '*' : n;
  }).join('');
}

// Define the format that mutates the info object.
const maskFormat = winston.format(info => {
  // You can CHANGE existing property values
  if (info.creditCard) {
    info.creditCard = maskCardNumbers(info.creditCard);
  }

  // You can also ADD NEW properties if you wish
  info.hasCreditCard = !!info.creditCard;

  return info;
});

// Then combine the format with other formats and make a logger
const logger = winston.createLogger({
  format: winston.format.combine(
    //
    // Order is important here, the formats are called in the
    // order they are passed to combine.
    //
    maskFormat(),
    winston.format.json()
  ),
  transports: [
    new winston.transports.Console()
  ]
});

logger.info('transaction ok', { creditCard: 123456789012345 });


================================================
FILE: examples/interpolation.js
================================================
'use strict';

const { createLogger, format, transports } = require('../');
const logger = createLogger({
  format: format.combine(
    format.splat(),
    format.simple()
  ),
  transports: [
    new transports.Console()
  ]
});

// info: test message my string {}
logger.log('info', 'test message %s', 'my string');

// info: test message my 123 {}
logger.log('info', 'test message %d', 123);

// info: test message first second {number: 123}
logger.log('info', 'test message %s, %s', 'first', 'second', { number: 123 });

// prints "Found error at %s"
logger.info('Found %s at %s', 'error', new Date());
logger.info('Found %s at %s', 'error', new Error('chill winston'));
logger.info('Found %s at %s', 'error', /WUT/);
logger.info('Found %s at %s', 'error', true);
logger.info('Found %s at %s', 'error', 100.00);
logger.info('Found %s at %s', 'error', ['1, 2, 3']);



================================================
FILE: examples/json.js
================================================
'use strict';

const winston = require('../');

//
// As of winston@3, the default logging format is JSON.
//
const logger = winston.createLogger({
  transports: [
    new winston.transports.Console(),
  ]
});

logger.log('info', 'Hello, this is a raw logging event',   { 'foo': 'bar' });
logger.log('info', 'Hello, this is a raw logging event 2', { 'foo': 'bar' });


================================================
FILE: examples/levels.js
================================================
'use strict';

const winston = require('../');

const defaultLevels = winston.createLogger({
  level: 'silly',
  format: winston.format.simple(),
  transports: new winston.transports.Console()
});

function logAllLevels() {
  Object.keys(winston.config.npm.levels).forEach(level => {
    defaultLevels[level](`is logged when logger.level="${defaultLevels.level}"`);
  });
}

logAllLevels();

//
// TODO: THIS IS BROKEN & MUST BE FIXED BEFORE 3.0
// Logger.prototype.level must be a setter to set the
// default level on all Transports.
//
defaultLevels.level = 'error';
logAllLevels();


================================================
FILE: examples/metadata.js
================================================
'use strict';

const winston = require('../');

const logger = winston.createLogger({
  level: 'info',
  format: winston.format.combine(
    //
    // Notice that both arguments have been combined into a single
    // "info" object.
    //
    winston.format(function (info, opts) {
      console.log(`{ reason: ${info.reason}, promise: ${info.promise} }`);
      return info;
    })(),
    winston.format.json()
  ),
  transports: [
    new winston.transports.Console()
  ]
});

logger.info('my message', { reason: 'whatever', promise: 'whenever' });


================================================
FILE: examples/quick-start.js
================================================
const { createLogger, format, transports } = require('../');

const logger = createLogger({
  level: 'info',
  format: format.combine(
    format.timestamp({
      format: 'YYYY-MM-DD HH:mm:ss'
    }),
    format.errors({ stack: true }),
    format.splat(),
    format.json()
  ),
  defaultMeta: { service: 'your-service-name' },
  transports: [
    //
    // - Write to all logs with level `info` and below to `quick-start-combined.log`.
    // - Write all logs error (and below) to `quick-start-error.log`.
    //
    new transports.File({ filename: 'quick-start-error.log', level: 'error' }),
    new transports.File({ filename: 'quick-start-combined.log' })
  ]
});

//
// If we're not in production then **ALSO** log to the `console`
// with the colorized simple format.
//
if (process.env.NODE_ENV !== 'production') {
  logger.add(new transports.Console({
    format: format.combine(
      format.colorize(),
      format.simple()
    )
  }));
}

// ***************
// Allows for JSON logging
// ***************

logger.log({
  level: 'info',
  message: 'Pass an object and this works',
  additional: 'properties',
  are: 'passed along'
});

logger.info({
  message: 'Use a helper method if you want',
  additional: 'properties',
  are: 'passed along'
});

// ***************
// Allows for parameter-based logging
// ***************

logger.log('info', 'Pass a message and this works', {
  additional: 'properties',
  are: 'passed along'
});

logger.info('Use a helper method if you want', {
  additional: 'properties',
  are: 'passed along'
});

// ***************
// Allows for string interpolation
// ***************

// info: test message my string {}
logger.log('info', 'test message %s', 'my string');

// info: test message 123 {}
logger.log('info', 'test message %d', 123);

// info: test message first second {number: 123}
logger.log('info', 'test message %s, %s', 'first', 'second', { number: 123 });

// prints "Found error at %s"
logger.info('Found %s at %s', 'error', new Date());
logger.info('Found %s at %s', 'error', new Error('chill winston'));
logger.info('Found %s at %s', 'error', /WUT/);
logger.info('Found %s at %s', 'error', true);
logger.info('Found %s at %s', 'error', 100.00);
logger.info('Found %s at %s', 'error', ['1, 2, 3']);

// ***************
// Allows for logging Error instances
// ***************

logger.warn(new Error('Error passed as info'));
logger.log('error', new Error('Error passed as message'));

logger.warn('Maybe important error: ', new Error('Error passed as meta'));
logger.log('error', 'Important error: ', new Error('Error passed as meta'));

logger.error(new Error('Error as info'));


================================================
FILE: examples/ready-to-use-pattern.ts
================================================
const winston = require('../');

const config = {
  levels: {
    error: 0,
    debug: 1,
    warn: 2,
    data: 3,
    info: 4,
    verbose: 5,
    silly: 6
  },
  colors: {
    error: 'red',
    debug: 'blue',
    warn: 'yellow',
    data: 'magenta',
    info: 'green',
    verbose: 'cyan',
    silly: 'grey'
  }
};

winston.addColors(config.colors);
const wLogger = (input: { logName: string; level: string }): winston.Logger =>
  winston.createLogger({
    levels: config.levels,
    level: `${input.level}`,
    transports: [
      new winston.transports.Console({
        level: `${input.level}`,

        format: winston.format.combine(
          winston.format.timestamp(),
          winston.format.printf(
            info =>
              // https://stackoverflow.com/a/69044670/20358783 more detailLocaleString
              `${new Date(info.timestamp).toLocaleDateString('tr-Tr', {
                year: 'numeric',
                month: '2-digit',
                day: '2-digit',
                hour: '2-digit',
                minute: '2-digit'
              })} ${info.level.toLocaleUpperCase()}: ${info.message}`
          ),
          winston.format.colorize({ all: true })
        )
      }),
      new winston.transports.File({
        filename: `./src/logs/${input.logName}/${input.logName}-Error.log`,
        level: 'error',
        format: winston.format.printf(
          info =>
            `${new Date(info.timestamp).toLocaleDateString('tr-Tr', {
              year: 'numeric',
              month: '2-digit',
              day: '2-digit',
              hour: '2-digit',
              minute: '2-digit'
            })} ${info.level.toLocaleUpperCase()}: ${info.message}`
        )
      }),
      new winston.transports.File({
        filename: `./src/logs/${input.logName}/${input.logName}-Warn.log`,
        level: 'warn',
        format: winston.format.printf(
          info =>
            `${new Date(info.timestamp).toLocaleDateString('tr-Tr', {
              year: 'numeric',
              month: '2-digit',
              day: '2-digit',
              hour: '2-digit',
              minute: '2-digit'
            })} ${info.level.toLocaleUpperCase()}: ${info.message}`
        )
      }),
      new winston.transports.File({
        filename: `./src/logs/${input.logName}/${input.logName}-All.log`,
        level: 'silly',
        format: winston.format.printf(
          info =>
            `${new Date(info.timestamp).toLocaleDateString('tr-Tr', {
              year: 'numeric',
              month: '2-digit',
              day: '2-digit',
              hour: '2-digit',
              minute: '2-digit'
            })} ${info.level.toLocaleUpperCase()}: ${info.message}`
        )
      }),

      new winston.transports.File({
        format: winston.format.printf(
          info =>
            `${new Date(info.timestamp).toLocaleDateString('tr-Tr', {
              year: 'numeric',
              month: '2-digit',
              day: '2-digit',
              hour: '2-digit',
              minute: '2-digit'
            })} ${info.level.toLocaleUpperCase()}: ${info.message}`
        ),
        filename: './src/logs/globalLog.log',
        level: 'silly'
      })
    ]
  });

export default wLogger;

//const logger = wLogger({ logName: moduleName, level: logLevel })
//logger.info('test')


================================================
FILE: examples/regular-expressions.js
================================================
'use strict';

const winston = require('../');

console.info(new RegExp('a'));
// prints "/a/"

//
// TODO: THIS IS BROKEN & MUST BE FIXED BEFORE 3.0?
//
winston.info(new RegExp('a'));
// prints "info: /a/"


================================================
FILE: examples/simple-stream.js
================================================
'use strict';

const fs = require('fs');
const path = require('path');
const winston = require('../lib/winston');

const filePath = path.join(__dirname, 'winston.log');
const stream = fs.createWriteStream(filePath);

const logger = winston.createLogger({
  transports: [
    new winston.transports.Stream({ stream })
  ]
});

setTimeout(() => {
  logger.log({ level: 'info', message: 'foo' });
  logger.log({ level: 'info', message: 'bar' });
}, 1000);

setTimeout(() => {
  try {
    fs.unlinkSync(filePath); // eslint-disable-line no-sync
  } catch (ex) {} // eslint-disable-line no-empty
}, 2000);


================================================
FILE: examples/splat-message.js
================================================
const winston = require('../');

const loggers = {
  splat: winston.createLogger({
    level: 'info',
    format: winston.format.combine(
      winston.format.splat(),
      winston.format.simple()
    ),
    transports: [new winston.transports.Console()],
  }),
  simple: winston.createLogger({
    level: 'info',
    format: winston.format.simple(),
    transports: [new winston.transports.Console()],
  })
};

const meta = {
  subject: 'Hello, World!',
  message: 'This message is a unique property separate from implicit merging.',
};

loggers.simple.info('email.message is hidden', meta);
loggers.simple.info('email.message is hidden %j\n', meta);

loggers.splat.info('This is overridden by meta', meta);
loggers.splat.info('email.message is shown %j', meta);


================================================
FILE: examples/splat.js
================================================
const winston = require('../');
let { format } = winston;

/*
 * Simple helper for stringifying all remaining
 * properties.
 */
function rest(info) {
  return JSON.stringify(Object.assign({}, info, {
    level: undefined,
    message: undefined,
    splat: undefined,
    label: undefined
  }));
}

let logger = winston.createLogger({
  transports: [new winston.transports.Console({ level: 'info' })],
  format: format.combine(
    format.splat(),
    format.printf(info => `[${info.label}] ${info.message} ${rest(info)}`)
  )
});

logger.log(
  'info',
  'any message',
  {
    label: 'label!',
    extra: true
  }
);

logger.log(
  'info',
  'let\'s %s some %s',
  'interpolate',
  'splat parameters',
  {
    label: 'label!',
    extra: true
  }
);

logger.log(
  'info',
  'first is a string %s [[%j]]',
  'behold a string',
  { beAware: 'this will interpolate' },
  {
    label: 'label!',
    extra: true
  }
);

logger.log(
  'info',
  'first is an object [[%j]]',
  { beAware: 'this will interpolate' },
  {
    label: 'label!',
    extra: true
  }
);

//
// Non-enumerable properties (such as "message" and "stack" in Error
// instances) will not be merged into any `info`.
//
const terr = new Error('lol please stop doing this');
terr.label = 'error';
terr.extra = true;
logger.log(
  'info',
  'any message',
  terr
);

logger.log(
  'info',
  'let\'s %s some %s',
  'interpolate',
  'splat parameters',
  terr
);



================================================
FILE: index.d.ts
================================================
// Type definitions for winston 3.0
// Project: https://github.com/winstonjs/winston

/// <reference types="node" />

import * as NodeJSStream from 'stream';

import * as logform from 'logform';
import * as Transport from 'winston-transport';

import * as Config from './lib/winston/config/index';
import * as Transports from './lib/winston/transports/index';

declare namespace winston {
  // Hoisted namespaces from other modules
  export import format = logform.format;
  export import Logform = logform;
  export import config = Config;
  export import transports = Transports;
  export import transport = Transport;

  class ExceptionHandler {
    constructor(logger: Logger);
    logger: Logger;
    handlers: Map<any, any>;
    catcher: Function | boolean;

    handle(...transports: Transport[]): void;
    unhandle(...transports: Transport[]): void;
    getAllInfo(err: string | Error): object;
    getProcessInfo(): object;
    getOsInfo(): object;
    getTrace(err: Error): object;
  }

  class RejectionHandler {
    constructor(logger: Logger);
    logger: Logger;
    handlers: Map<any, any>;
    catcher: Function | boolean;

    handle(...transports: Transport[]): void;
    unhandle(...transports: Transport[]): void;
    getAllInfo(err: string | Error): object;
    getProcessInfo(): object;
    getOsInfo(): object;
    getTrace(err: Error): object;
  }

  interface QueryOptions {
    rows?: number;
    limit?: number;
    start?: number;
    from?: Date;
    until?: Date;
    order?: 'asc' | 'desc';
    fields: any;
  }

  class Profiler {
    logger: Logger;
    start: Number;
    done(info?: any): boolean;
  }

  interface LogEntry {
    level: string;
    message: string;
    [optionName: string]: any;
  }

  interface LogMethod {
    (level: string, message: string, ...meta: any[]): Logger;
    (entry: LogEntry): Logger;
    (level: string, message: any): Logger;
  }

  interface LeveledLogMethod {
    (message: string, ...meta: any[]): Logger;
    (message: any): Logger;
    (infoObject: object): Logger;
  }

  interface LoggerOptions {
    levels?: Config.AbstractConfigSetLevels;
    silent?: boolean;
    format?: logform.Format;
    level?: string;
    exitOnError?: Function | boolean;
    defaultMeta?: any;
    transports?: Transport[] | Transport;
    handleExceptions?: boolean;
    handleRejections?: boolean;
    exceptionHandlers?: any;
    rejectionHandlers?: any;
  }

  class Logger extends NodeJSStream.Transform {
    constructor(options?: LoggerOptions);

    silent: boolean;
    format: logform.Format;
    levels: Config.AbstractConfigSetLevels;
    level: string;
    transports: Transport[];
    exceptions: ExceptionHandler;
    rejections: RejectionHandler;
    profilers: object;
    exitOnError: Function | boolean;
    defaultMeta?: any;

    log: LogMethod;
    add(transport: Transport): this;
    remove(transport: Transport): this;
    clear(): this;
    close(): this;

    // for cli and npm levels
    error: LeveledLogMethod;
    warn: LeveledLogMethod;
    help: LeveledLogMethod;
    data: LeveledLogMethod;
    info: LeveledLogMethod;
    debug: LeveledLogMethod;
    prompt: LeveledLogMethod;
    http: LeveledLogMethod;
    verbose: LeveledLogMethod;
    input: LeveledLogMethod;
    silly: LeveledLogMethod;

    // for syslog levels only
    emerg: LeveledLogMethod;
    alert: LeveledLogMethod;
    crit: LeveledLogMethod;
    warning: LeveledLogMethod;
    notice: LeveledLogMethod;

    query(
      options?: QueryOptions,
      callback?: (err: Error, results: any) => void
    ): any;
    stream(options?: any): NodeJS.ReadableStream;

    startTimer(): Profiler;
    profile(id: string | number, meta?: Record<string, any>): this;

    configure(options: LoggerOptions): void;

    child(options: Object): this;

    isLevelEnabled(level: string): boolean;
    isErrorEnabled(): boolean;
    isWarnEnabled(): boolean;
    isInfoEnabled(): boolean;
    isVerboseEnabled(): boolean;
    isDebugEnabled(): boolean;
    isSillyEnabled(): boolean;
  }

  class Container {
    loggers: Map<string, Logger>;
    options: LoggerOptions;

    add(id: string, options?: LoggerOptions): Logger;
    get(id: string, options?: LoggerOptions): Logger;
    has(id: string): boolean;
    close(id?: string): void;

    constructor(options?: LoggerOptions);
  }

  let version: string;
  let loggers: Container;

  let addColors: (target: Config.AbstractConfigSetColors) => any;
  let createLogger: (options?: LoggerOptions) => Logger;

  // Pass-through npm level methods routed to the default logger.
  let error: LeveledLogMethod;
  let warn: LeveledLogMethod;
  let info: LeveledLogMethod;
  let http: LeveledLogMethod;
  let verbose: LeveledLogMethod;
  let debug: LeveledLogMethod;
  let silly: LeveledLogMethod;

  // Other pass-through methods routed to the default logger.
  let log: LogMethod;
  let query: (
    options?: QueryOptions,
    callback?: (err: Error, results: any) => void
  ) => any;
  let stream: (options?: any) => NodeJS.ReadableStream;
  let add: (transport: Transport) => Logger;
  let remove: (transport: Transport) => Logger;
  let clear: () => Logger;
  let startTimer: () => Profiler;
  let profile: (id: string | number) => Logger;
  let configure: (options: LoggerOptions) => void;
  let child: (options: Object) => Logger;
  let level: string;
  let exceptions: ExceptionHandler;
  let rejections: RejectionHandler;
  let exitOnError: Function | boolean;
  // let default: object;
}

export = winston;


================================================
FILE: jest.config.js
================================================
/**
 * @type {import('@jest/types').Config.InitialOptions}
 */
module.exports = {
  collectCoverage: false,
  collectCoverageFrom: [
    '<rootDir>/lib/**/*.js'
  ],
  coverageDirectory: 'coverage',
  testEnvironment: 'node',
  testMatch: [
    '<rootDir>/test/**/*.test.js'
  ],
  globalSetup: '<rootDir>/test/globalSetup.js',
  silent: true,
  verbose: true,
  coverageThreshold: {
    global: {
      functions: 74.54,
      lines: 72.48,
      statements: 72.25,
      branches: 64.04
    }
  }
};



================================================
FILE: lib/winston/common.js
================================================
/**
 * common.js: Internal helper and utility functions for winston.
 *
 * (C) 2010 Charlie Robbins
 * MIT LICENCE
 */

'use strict';

const { format } = require('util');

/**
 * Set of simple deprecation notices and a way to expose them for a set of
 * properties.
 * @type {Object}
 * @private
 */
exports.warn = {
  deprecated(prop) {
    return () => {
      throw new Error(format('{ %s } was removed in winston@3.0.0.', prop));
    };
  },
  useFormat(prop) {
    return () => {
      throw new Error([
        format('{ %s } was removed in winston@3.0.0.', prop),
        'Use a custom winston.format = winston.format(function) instead.'
      ].join('\n'));
    };
  },
  forFunctions(obj, type, props) {
    props.forEach(prop => {
      obj[prop] = exports.warn[type](prop);
    });
  },
  forProperties(obj, type, props) {
    props.forEach(prop => {
      const notice = exports.warn[type](prop);
      Object.defineProperty(obj, prop, {
        get: notice,
        set: notice
      });
    });
  }
};


================================================
FILE: lib/winston/config/index.d.ts
================================================
// Type definitions for winston 3.0
// Project: https://github.com/winstonjs/winston

/// <reference types="node" />

declare namespace winston {
  interface AbstractConfigSetLevels {
    [key: string]: number;
  }

  interface AbstractConfigSetColors {
    [key: string]: string | string[];
  }

  interface AbstractConfigSet {
    levels: AbstractConfigSetLevels;
    colors: AbstractConfigSetColors;
  }

  interface CliConfigSetLevels extends AbstractConfigSetLevels {
    error: number;
    warn: number;
    help: number;
    data: number;
    info: number;
    debug: number;
    prompt: number;
    verbose: number;
    input: number;
    silly: number;
  }

  interface CliConfigSetColors extends AbstractConfigSetColors {
    error: string | string[];
    warn: string | string[];
    help: string | string[];
    data: string | string[];
    info: string | string[];
    debug: string | string[];
    prompt: string | string[];
    verbose: string | string[];
    input: string | string[];
    silly: string | string[];
  }

  interface NpmConfigSetLevels extends AbstractConfigSetLevels {
    error: number;
    warn: number;
    info: number;
    http: number;
    verbose: number;
    debug: number;
    silly: number;
  }

  interface NpmConfigSetColors extends AbstractConfigSetColors {
    error: string | string[];
    warn: string | string[];
    info: string | string[];
    http: string | string[];
    verbose: string | string[];
    debug: string | string[];
    silly: string | string[];
  }

  interface SyslogConfigSetLevels extends AbstractConfigSetLevels {
    emerg: number;
    alert: number;
    crit: number;
    error: number;
    warning: number;
    notice: number;
    info: number;
    debug: number;
  }

  interface SyslogConfigSetColors extends AbstractConfigSetColors {
    emerg: string | string[];
    alert: string | string[];
    crit: string | string[];
    error: string | string[];
    warning: string | string[];
    notice: string | string[];
    info: string | string[];
    debug: string | string[];
  }

  interface Config {
    allColors: AbstractConfigSetColors;
    cli: { levels: CliConfigSetLevels, colors: CliConfigSetColors };
    npm: { levels: NpmConfigSetLevels, colors: NpmConfigSetColors };
    syslog: { levels: SyslogConfigSetLevels, colors: SyslogConfigSetColors };

    addColors(colors: AbstractConfigSetColors): void;
  }
}

declare const winston: winston.Config;
export = winston;


================================================
FILE: lib/winston/config/index.js
================================================
/**
 * index.js: Default settings for all levels that winston knows about.
 *
 * (C) 2010 Charlie Robbins
 * MIT LICENCE
 */

'use strict';

const logform = require('logform');
const { configs } = require('triple-beam');

/**
 * Export config set for the CLI.
 * @type {Object}
 */
exports.cli = logform.levels(configs.cli);

/**
 * Export config set for npm.
 * @type {Object}
 */
exports.npm = logform.levels(configs.npm);

/**
 * Export config set for the syslog.
 * @type {Object}
 */
exports.syslog = logform.levels(configs.syslog);

/**
 * Hoist 
Download .txt
gitextract_0r69vkma/

├── .babelrc
├── .editorconfig
├── .eslintrc
├── .gitattributes
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.yml
│   │   ├── config.yml
│   │   └── feature_request.yml
│   ├── dependabot.yml
│   └── workflows/
│       └── ci.yml
├── .gitignore
├── .npmignore
├── .prettierrc
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── SECURITY.md
├── UPGRADE-3.0.md
├── docs/
│   ├── publishing.md
│   ├── releases.md
│   └── transports.md
├── examples/
│   ├── color-message.js
│   ├── create-file.js
│   ├── custom-levels-colors.js
│   ├── custom-levels.js
│   ├── custom-pretty-print.js
│   ├── custom-timestamp.js
│   ├── custom-transport.js
│   ├── delete-level.js
│   ├── errors.js
│   ├── exception.js
│   ├── file-maxsize.js
│   ├── finish-event.js
│   ├── format-dynamic-content.js
│   ├── format-filter.js
│   ├── format-logger-and-transport.js
│   ├── format-mutate.js
│   ├── interpolation.js
│   ├── json.js
│   ├── levels.js
│   ├── metadata.js
│   ├── quick-start.js
│   ├── ready-to-use-pattern.ts
│   ├── regular-expressions.js
│   ├── simple-stream.js
│   ├── splat-message.js
│   └── splat.js
├── index.d.ts
├── jest.config.js
├── lib/
│   ├── winston/
│   │   ├── common.js
│   │   ├── config/
│   │   │   ├── index.d.ts
│   │   │   └── index.js
│   │   ├── container.js
│   │   ├── create-logger.js
│   │   ├── exception-handler.js
│   │   ├── exception-stream.js
│   │   ├── logger.js
│   │   ├── profiler.js
│   │   ├── rejection-handler.js
│   │   ├── rejection-stream.js
│   │   ├── tail-file.js
│   │   └── transports/
│   │       ├── console.js
│   │       ├── file.js
│   │       ├── http.js
│   │       ├── index.d.ts
│   │       ├── index.js
│   │       └── stream.js
│   └── winston.js
├── package.json
├── publishing.md
├── test/
│   ├── fixtures/
│   │   ├── .gitkeep
│   │   ├── keys/
│   │   │   ├── agent2-cert.pem
│   │   │   └── agent2-key.pem
│   │   └── logs/
│   │       └── .gitkeep
│   ├── globalSetup.js
│   ├── helpers/
│   │   ├── handler-tests.js
│   │   ├── index.js
│   │   ├── mocks/
│   │   │   ├── legacy-mixed-transport.js
│   │   │   ├── legacy-transport.js
│   │   │   └── mock-transport.js
│   │   └── scripts/
│   │       ├── colorize.js
│   │       ├── default-rejections.js
│   │       ├── exit-on-error.js
│   │       ├── log-rejections.js
│   │       ├── unhandle-exceptions.js
│   │       └── unhandle-rejections.js
│   ├── integration/
│   │   ├── formats.test.js
│   │   └── logger.test.js
│   ├── jest.config.integration.js
│   ├── jest.config.unit.js
│   ├── tsconfig.json
│   ├── typescript-definitions.ts
│   └── unit/
│       ├── formats/
│       │   └── errors.test.js
│       └── winston/
│           ├── config/
│           │   └── config.test.js
│           ├── container.test.js
│           ├── create-logger.test.js
│           ├── exception-handler.test.js
│           ├── exception-stream.test.js
│           ├── log-exception.test.js
│           ├── logger-legacy.test.js
│           ├── logger.test.js
│           ├── profiler.test.js
│           ├── rejection-handler.test.js
│           ├── tail-file.test.js
│           ├── transports/
│           │   ├── 00-file-stress.test.js
│           │   ├── console.test.js
│           │   ├── error.test.js
│           │   ├── file-create-dir.test.js
│           │   ├── file.test.js
│           │   ├── http.test.js
│           │   └── stream.test.js
│           └── winston.test.js
└── tsconfig.json
Download .txt
SYMBOL INDEX (169 symbols across 35 files)

FILE: examples/custom-transport.js
  class CustomTransport (line 9) | class CustomTransport extends Transport {
    method constructor (line 10) | constructor(opts) {
    method log (line 21) | log(info, callback) {

FILE: examples/format-mutate.js
  function maskCardNumbers (line 8) | function maskCardNumbers(num) {

FILE: examples/levels.js
  function logAllLevels (line 11) | function logAllLevels() {

FILE: examples/splat.js
  function rest (line 8) | function rest(info) {

FILE: index.d.ts
  class ExceptionHandler (line 22) | class ExceptionHandler {
  class RejectionHandler (line 36) | class RejectionHandler {
  type QueryOptions (line 50) | interface QueryOptions {
  class Profiler (line 60) | class Profiler {
  type LogEntry (line 66) | interface LogEntry {
  type LogMethod (line 72) | interface LogMethod {
  type LeveledLogMethod (line 78) | interface LeveledLogMethod {
  type LoggerOptions (line 84) | interface LoggerOptions {
  class Logger (line 98) | class Logger extends NodeJSStream.Transform {
  class Container (line 160) | class Container {

FILE: lib/winston.js
  method get (line 119) | get() {
  method set (line 122) | set(val) {
  method get (line 133) | get() {
  method get (line 144) | get() {
  method get (line 156) | get() {
  method set (line 159) | set(val) {
  method get (line 170) | get() {

FILE: lib/winston/common.js
  method deprecated (line 19) | deprecated(prop) {
  method useFormat (line 24) | useFormat(prop) {
  method forFunctions (line 32) | forFunctions(obj, type, props) {
  method forProperties (line 37) | forProperties(obj, type, props) {

FILE: lib/winston/config/index.d.ts
  type AbstractConfigSetLevels (line 7) | interface AbstractConfigSetLevels {
  type AbstractConfigSetColors (line 11) | interface AbstractConfigSetColors {
  type AbstractConfigSet (line 15) | interface AbstractConfigSet {
  type CliConfigSetLevels (line 20) | interface CliConfigSetLevels extends AbstractConfigSetLevels {
  type CliConfigSetColors (line 33) | interface CliConfigSetColors extends AbstractConfigSetColors {
  type NpmConfigSetLevels (line 46) | interface NpmConfigSetLevels extends AbstractConfigSetLevels {
  type NpmConfigSetColors (line 56) | interface NpmConfigSetColors extends AbstractConfigSetColors {
  type SyslogConfigSetLevels (line 66) | interface SyslogConfigSetLevels extends AbstractConfigSetLevels {
  type SyslogConfigSetColors (line 77) | interface SyslogConfigSetColors extends AbstractConfigSetColors {
  type Config (line 88) | interface Config {

FILE: lib/winston/container.js
  method constructor (line 22) | constructor(options = {}) {
  method add (line 34) | add(id, options) {
  method get (line 64) | get(id, options) {
  method has (line 74) | has(id) {
  method close (line 84) | close(id) {
  method _removeLogger (line 98) | _removeLogger(id) {
  method _delete (line 115) | _delete(id) {

FILE: lib/winston/create-logger.js
  function isLevelEnabledFunctionName (line 15) | function isLevelEnabledFunctionName(level) {
  class DerivedLogger (line 36) | class DerivedLogger extends Logger {
    method constructor (line 43) | constructor(options) {

FILE: lib/winston/exception-handler.js
  method constructor (line 26) | constructor(logger) {
  method handle (line 40) | handle(...args) {
  method unhandle (line 60) | unhandle() {
  method getAllInfo (line 75) | getAllInfo(err) {
  method getProcessInfo (line 102) | getProcessInfo() {
  method getOsInfo (line 119) | getOsInfo() {
  method getTrace (line 131) | getTrace(err) {
  method _addHandler (line 150) | _addHandler(handler) {
  method _uncaughtException (line 166) | _uncaughtException(err) {
  method _getExceptionHandlers (line 235) | _getExceptionHandlers() {

FILE: lib/winston/exception-stream.js
  method constructor (line 24) | constructor(transport) {
  method _write (line 46) | _write(info, enc, callback) {

FILE: lib/winston/logger.js
  class Logger (line 34) | class Logger extends Transform {
    method constructor (line 40) | constructor(options) {
    method child (line 45) | child(defaultRequestMetadata) {
    method configure (line 82) | configure({
    method getHighestLogLevel (line 160) | getHighestLogLevel() {
    method isLevelEnabled (line 175) | isLevelEnabled(level) {
    method log (line 230) | log(level, msg, ...splat) {
    method _transform (line 299) | _transform(info, enc, callback) {
    method _final (line 350) | _final(callback) {
    method add (line 368) | add(transport) {
    method remove (line 406) | remove(transport) {
    method clear (line 425) | clear() {
    method close (line 435) | close() {
    method setLevels (line 447) | setLevels() {
    method query (line 458) | query(options, callback) {
    method stream (line 521) | stream(options = {}) {
    method startTimer (line 572) | startTimer() {
    method profile (line 583) | profile(id, ...args) {
    method handleExceptions (line 615) | handleExceptions(...args) {
    method unhandleExceptions (line 628) | unhandleExceptions(...args) {
    method cli (line 640) | cli() {
    method _onEvent (line 657) | _onEvent(event, transport) {
    method _addDefaultMeta (line 672) | _addDefaultMeta(msg) {
  function getLevelValue (line 679) | function getLevelValue(levels, level) {
  method get (line 694) | get() {

FILE: lib/winston/profiler.js
  class Profiler (line 14) | class Profiler {
    method constructor (line 22) | constructor(logger) {
    method done (line 38) | done(...args) {

FILE: lib/winston/rejection-handler.js
  method constructor (line 26) | constructor(logger) {
  method handle (line 40) | handle(...args) {
  method unhandle (line 60) | unhandle() {
  method getAllInfo (line 76) | getAllInfo(err) {
  method getProcessInfo (line 103) | getProcessInfo() {
  method getOsInfo (line 120) | getOsInfo() {
  method getTrace (line 132) | getTrace(err) {
  method _addHandler (line 151) | _addHandler(handler) {
  method _unhandledRejection (line 167) | _unhandledRejection(err) {
  method _getRejectionHandlers (line 241) | _getRejectionHandlers() {

FILE: lib/winston/rejection-stream.js
  method constructor (line 24) | constructor(transport) {
  method _write (line 44) | _write(info, enc, callback) {

FILE: lib/winston/tail-file.js
  function noop (line 18) | function noop() {}

FILE: lib/winston/transports/console.js
  method constructor (line 26) | constructor(options = {}) {
  method log (line 52) | log(info, callback) {
  method _stringArrayToSet (line 106) | _stringArrayToSet(strArray, errMsg) {

FILE: lib/winston/transports/file.js
  method constructor (line 33) | constructor(options = {}) {
  method finishIfEnding (line 98) | finishIfEnding() {
  method _final (line 119) | _final(callback) {
  method log (line 150) | log(info, callback = () => { }) {
  method query (line 278) | query(options, callback) {
  method stream (line 427) | stream(options = {}) {
  method open (line 456) | open() {
  method stat (line 486) | stat(callback) {
  method close (line 521) | close(cb) {
  method _needsNewFile (line 540) | _needsNewFile(size) {
  method _onError (line 550) | _onError(err) {
  method _setupStream (line 559) | _setupStream(stream) {
  method _cleanupStream (line 570) | _cleanupStream(stream) {
  method _rotateFile (line 579) | _rotateFile() {
  method _endStream (line 590) | _endStream(callback = () => { }) {
  method _createStream (line 609) | _createStream(source) {
  method _incFile (line 644) | _incFile(callback) {
  method _getFile (line 683) | _getFile() {
  method _checkMaxFilesIncrementing (line 706) | _checkMaxFilesIncrementing(ext, basename, callback) {
  method _checkMaxFilesTailable (line 732) | _checkMaxFilesTailable(ext, basename, callback) {
  method _compressFile (line 773) | _compressFile(src, dest, callback) {
  method _createLogDirIfNotExist (line 788) | _createLogDirIfNotExist(dirPath) {

FILE: lib/winston/transports/http.js
  method constructor (line 28) | constructor(options = {}) {
  method log (line 60) | log(info, callback) {
  method query (line 86) | query(options, callback) {
  method stream (line 129) | stream(options = {}) {
  method _request (line 174) | _request(options, auth, path, callback) {
  method _doBatch (line 194) | _doBatch(options, callback, auth, path) {
  method _doBatchRequest (line 218) | _doBatchRequest(callback, auth, path) {
  method _doRequest (line 236) | _doRequest(options, callback, auth, path) {

FILE: lib/winston/transports/index.d.ts
  type ConsoleTransportOptions (line 11) | interface ConsoleTransportOptions extends Transport.TransportStreamOptio...
  type ConsoleTransportInstance (line 19) | interface ConsoleTransportInstance extends Transport {
  type FileTransportOptions (line 27) | interface FileTransportOptions extends Transport.TransportStreamOptions {
  type FileTransportInstance (line 41) | interface FileTransportInstance extends Transport {
  type HttpTransportOptions (line 57) | interface HttpTransportOptions extends Transport.TransportStreamOptions {
  type HttpTransportInstance (line 76) | interface HttpTransportInstance extends Transport {
  type StreamTransportOptions (line 93) | interface StreamTransportOptions extends Transport.TransportStreamOptions {
  type StreamTransportInstance (line 98) | interface StreamTransportInstance extends Transport {
  type Transports (line 104) | interface Transports {

FILE: lib/winston/transports/index.js
  method get (line 17) | get() {
  method get (line 29) | get() {
  method get (line 41) | get() {
  method get (line 53) | get() {

FILE: lib/winston/transports/stream.js
  method constructor (line 26) | constructor(options = {}) {
  method log (line 47) | log(info, callback) {

FILE: test/globalSetup.js
  function cleanTestArtifacts (line 4) | function cleanTestArtifacts() {

FILE: test/helpers/mocks/legacy-mixed-transport.js
  method constructor (line 16) | constructor(options = {}) {
  method log (line 36) | log(level, msg, meta, callback) {

FILE: test/helpers/mocks/mock-transport.js
  function createMockTransport (line 11) | function createMockTransport(write) {

FILE: test/integration/formats.test.js
  function spawnColorizer (line 22) | function spawnColorizer(callback) {

FILE: test/integration/logger.test.js
  class CustomLogger (line 12) | class CustomLogger extends Logger {}

FILE: test/unit/formats/errors.test.js
  function assumeExpectedInfo (line 17) | function assumeExpectedInfo(info, target = {}) {

FILE: test/unit/winston/exception-stream.test.js
  function writeToStreamAsync (line 16) | async function writeToStreamAsync(stream, payload) {

FILE: test/unit/winston/logger.test.js
  function logLevelTransport (line 306) | function logLevelTransport(level) {
  function filterLevelTransport (line 342) | function filterLevelTransport(level) {
  method log (line 371) | log(obj) {

FILE: test/unit/winston/tail-file.test.js
  function logOnInterval (line 21) | function logOnInterval(opts, done) {
  function startTailFile (line 70) | function startTailFile() {

FILE: test/unit/winston/transports/console.test.js
  function assertLogLevelsValues (line 51) | function assertLogLevelsValues(transport, logLevels, logLevelsName = 'st...

FILE: test/unit/winston/transports/file.test.js
  function logToTransport (line 23) | async function logToTransport(transport, opts = {}) {
  function waitForFile (line 50) | async function waitForFile(filename, timeout = 1000, interval = 20) {
  function removeFixtures (line 65) | async function removeFixtures() {
  function getFilePath (line 68) | function getFilePath(filename) {

FILE: test/unit/winston/transports/http.test.js
  function mockHttpServer (line 16) | function mockHttpServer(done, expectedLog) {
  function assumeError (line 35) | function assumeError(err) {
  function onLogged (line 41) | function onLogged(context, done) {
Condensed preview — 114 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (443K chars).
[
  {
    "path": ".babelrc",
    "chars": 39,
    "preview": "{\n  \"presets\": [\"@babel/preset-env\"]\n}\n"
  },
  {
    "path": ".editorconfig",
    "chars": 305,
    "preview": "# EditorConfig is awesome: https://EditorConfig.org\n\n# top-most EditorConfig file\nroot = true\n\n# default configuration\n["
  },
  {
    "path": ".eslintrc",
    "chars": 248,
    "preview": "{\n  \"env\": {\n    \"jest\": true,\n  },\n  \"extends\": \"@dabh/eslint-config-populist\",\n  \"rules\": {\n    \"one-var\": [\"error\", {"
  },
  {
    "path": ".gitattributes",
    "chars": 25,
    "preview": "package-lock.json binary\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.yml",
    "chars": 2738,
    "preview": "name: Have you encountered an issue?\ndescription: Report an issue with Winston.\ntitle: \"[Bug]: \"\nlabels: [\"Bug\", \"Needs "
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "chars": 412,
    "preview": "blank_issues_enabled: false\ncontact_links:\n  - name: Have a formatting issue or feature request?\n    url: https://github"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.yml",
    "chars": 1403,
    "preview": "name: Would you like to see a feature implemented?\ndescription: Request a new feature for Winston\ntitle: \"[Feature Reque"
  },
  {
    "path": ".github/dependabot.yml",
    "chars": 193,
    "preview": "version: 2\nupdates:\n  - package-ecosystem: github-actions\n    directory: /\n    schedule:\n      interval: weekly\n  - pack"
  },
  {
    "path": ".github/workflows/ci.yml",
    "chars": 1158,
    "preview": "name: CI Checks\n\non:\n  pull_request:\n    branches:\n      - main\n      - master\n  push:\n    branches:\n      - main\n      "
  },
  {
    "path": ".gitignore",
    "chars": 215,
    "preview": "test/*.log\ntest/fixtures/*.json\ntest/fixtures/file/*.log*\ntest/fixtures/logs/*.log*\nnode_modules/\nnode_modules/*\nnpm-deb"
  },
  {
    "path": ".npmignore",
    "chars": 109,
    "preview": ".nyc_output/\ncoverage/\ndocs\nexamples/\nscratch/\ntest/\n.*\n*.log\n*.md\nappveyor.yml\ntsconfig.json\njest.config.js\n"
  },
  {
    "path": ".prettierrc",
    "chars": 403,
    "preview": "{\n  \"arrowParens\": \"avoid\",\n  \"bracketSameLine\": false,\n  \"bracketSpacing\": true,\n  \"embeddedLanguageFormatting\": \"auto\""
  },
  {
    "path": "CHANGELOG.md",
    "chars": 45057,
    "preview": "# CHANGELOG\n\n## [v3.9.0](https://github.com/winstonjs/winston/compare/v3.8.2...v3.9.0)\n### Functionality changes\n* Handl"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 3234,
    "preview": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, w"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 5090,
    "preview": "# CONTRIBUTING\nPLEASE NOTE: This document has not been updated in a while and is out of date, but contents are retained "
  },
  {
    "path": "LICENSE",
    "chars": 1058,
    "preview": "Copyright (c) 2010 Charlie Robbins\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this"
  },
  {
    "path": "README.md",
    "chars": 36667,
    "preview": "# winston\n\nA logger for just about everything.\n\n[![Version npm](https://img.shields.io/npm/v/winston.svg?style=flat-squa"
  },
  {
    "path": "SECURITY.md",
    "chars": 119,
    "preview": "# Security Policy\n\n## Reporting a Vulnerability\n\nPlease report security issues to `npm view yadeep maintainers.email`.\n"
  },
  {
    "path": "UPGRADE-3.0.md",
    "chars": 10842,
    "preview": "# Upgrading to `winston@3.0.0`\n\n> This document represents a **living guide** on upgrading to `winston@3`.\n> Much attent"
  },
  {
    "path": "docs/publishing.md",
    "chars": 3231,
    "preview": "The release process here mostly follows along with the [vbump script](https://github.com/indexzero/vbump) that @indexzer"
  },
  {
    "path": "docs/releases.md",
    "chars": 3983,
    "preview": "# Past Release Roadmaps\n\nBelow is the list of items that made up the roadmap for past releases. \n\n- [Version 3.0.0](#ver"
  },
  {
    "path": "docs/transports.md",
    "chars": 44988,
    "preview": "# Winston Transports\n\nIn `winston` a transport is essentially a storage device for your logs. Each\ninstance of a winston"
  },
  {
    "path": "examples/color-message.js",
    "chars": 323,
    "preview": "'use strict';\n\nconst winston = require('../');\n\nconst logger = module.exports = winston.createLogger({\n  transports: [ne"
  },
  {
    "path": "examples/create-file.js",
    "chars": 713,
    "preview": "'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst winston = require('../lib/winston');\n\nconst"
  },
  {
    "path": "examples/custom-levels-colors.js",
    "chars": 723,
    "preview": "'use strict';\n\nconst winston = require('../lib/winston');\n\n//\n// Logging levels\n//\nconst config = {\n  levels: {\n    erro"
  },
  {
    "path": "examples/custom-levels.js",
    "chars": 609,
    "preview": "'use strict';\n\nconst winston = require('../');\n\nconst myCustomLevels = {\n  levels: {\n    foo: 0,\n    bar: 1,\n    baz: 2,"
  },
  {
    "path": "examples/custom-pretty-print.js",
    "chars": 508,
    "preview": "'use strict';\n\nconst winston = require('../');\n\nconst logger = winston.createLogger({\n  format: winston.format.printf(in"
  },
  {
    "path": "examples/custom-timestamp.js",
    "chars": 750,
    "preview": "const { format, createLogger, transports } = require('../');\n\nconst logger = createLogger({\n  format: format.combine(\n  "
  },
  {
    "path": "examples/custom-transport.js",
    "chars": 1002,
    "preview": "\nconst { createLogger } = require('../');\nconst Transport = require('winston-transport');\n\n//\n// Inherit from `winston-t"
  },
  {
    "path": "examples/delete-level.js",
    "chars": 518,
    "preview": "'use strict';\n\nconst { createLogger, format, transports } = require('../');\nconst { combine, json } = format;\n\nconst sev"
  },
  {
    "path": "examples/errors.js",
    "chars": 556,
    "preview": "const { createLogger, format, transports } = require('../');\nconst { combine, errors, json } = format;\n\nconst logger = c"
  },
  {
    "path": "examples/exception.js",
    "chars": 408,
    "preview": "'use strict';\n\nconst winston = require('../');\n\n//\n// TODO: THIS IS BROKEN & MUST BE FIXED BEFORE 3.0\n// This should out"
  },
  {
    "path": "examples/file-maxsize.js",
    "chars": 679,
    "preview": "const path = require('path');\nconst { MESSAGE } = require('triple-beam');\nconst winston = require('../');\n\nconst logger "
  },
  {
    "path": "examples/finish-event.js",
    "chars": 794,
    "preview": "'use strict';\n\nconst winston = require('../');\n\n//\n// In winston@3.x both the Logger and the Transport are Node.js strea"
  },
  {
    "path": "examples/format-dynamic-content.js",
    "chars": 423,
    "preview": "'use strict';\n\nconst winston = require('../');\n\nconst logger = module.exports = winston.createLogger({\n  transports: [ne"
  },
  {
    "path": "examples/format-filter.js",
    "chars": 666,
    "preview": "const { createLogger, format, transports } = require('../');\n\n// Ignore log messages if the have { private: true }\nconst"
  },
  {
    "path": "examples/format-logger-and-transport.js",
    "chars": 574,
    "preview": "const fs = require('fs');\nconst winston = require('../');\nconst { createLogger, format, transports } = winston;\n\nconst l"
  },
  {
    "path": "examples/format-mutate.js",
    "chars": 1052,
    "preview": "'use strict';\n\nconst winston = require('../');\n\n/*\n * Simple string mask. For example purposes only.\n */\nfunction maskCa"
  },
  {
    "path": "examples/interpolation.js",
    "chars": 870,
    "preview": "'use strict';\n\nconst { createLogger, format, transports } = require('../');\nconst logger = createLogger({\n  format: form"
  },
  {
    "path": "examples/json.js",
    "chars": 367,
    "preview": "'use strict';\n\nconst winston = require('../');\n\n//\n// As of winston@3, the default logging format is JSON.\n//\nconst logg"
  },
  {
    "path": "examples/levels.js",
    "chars": 586,
    "preview": "'use strict';\n\nconst winston = require('../');\n\nconst defaultLevels = winston.createLogger({\n  level: 'silly',\n  format:"
  },
  {
    "path": "examples/metadata.js",
    "chars": 552,
    "preview": "'use strict';\n\nconst winston = require('../');\n\nconst logger = winston.createLogger({\n  level: 'info',\n  format: winston"
  },
  {
    "path": "examples/quick-start.js",
    "chars": 2643,
    "preview": "const { createLogger, format, transports } = require('../');\n\nconst logger = createLogger({\n  level: 'info',\n  format: f"
  },
  {
    "path": "examples/ready-to-use-pattern.ts",
    "chars": 3333,
    "preview": "const winston = require('../');\n\nconst config = {\n  levels: {\n    error: 0,\n    debug: 1,\n    warn: 2,\n    data: 3,\n    "
  },
  {
    "path": "examples/regular-expressions.js",
    "chars": 207,
    "preview": "'use strict';\n\nconst winston = require('../');\n\nconsole.info(new RegExp('a'));\n// prints \"/a/\"\n\n//\n// TODO: THIS IS BROK"
  },
  {
    "path": "examples/simple-stream.js",
    "chars": 601,
    "preview": "'use strict';\n\nconst fs = require('fs');\nconst path = require('path');\nconst winston = require('../lib/winston');\n\nconst"
  },
  {
    "path": "examples/splat-message.js",
    "chars": 765,
    "preview": "const winston = require('../');\n\nconst loggers = {\n  splat: winston.createLogger({\n    level: 'info',\n    format: winsto"
  },
  {
    "path": "examples/splat.js",
    "chars": 1426,
    "preview": "const winston = require('../');\nlet { format } = winston;\n\n/*\n * Simple helper for stringifying all remaining\n * propert"
  },
  {
    "path": "index.d.ts",
    "chars": 5512,
    "preview": "// Type definitions for winston 3.0\n// Project: https://github.com/winstonjs/winston\n\n/// <reference types=\"node\" />\n\nim"
  },
  {
    "path": "jest.config.js",
    "chars": 503,
    "preview": "/**\n * @type {import('@jest/types').Config.InitialOptions}\n */\nmodule.exports = {\n  collectCoverage: false,\n  collectCov"
  },
  {
    "path": "lib/winston/common.js",
    "chars": 1016,
    "preview": "/**\n * common.js: Internal helper and utility functions for winston.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE\n */\n\n"
  },
  {
    "path": "lib/winston/config/index.d.ts",
    "chars": 2453,
    "preview": "// Type definitions for winston 3.0\n// Project: https://github.com/winstonjs/winston\n\n/// <reference types=\"node\" />\n\nde"
  },
  {
    "path": "lib/winston/config/index.js",
    "chars": 676,
    "preview": "/**\n * index.js: Default settings for all levels that winston knows about.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE"
  },
  {
    "path": "lib/winston/container.js",
    "chars": 3361,
    "preview": "/**\n * container.js: Inversion of control container for winston logger instances.\n *\n * (C) 2010 Charlie Robbins\n * MIT "
  },
  {
    "path": "lib/winston/create-logger.js",
    "chars": 3140,
    "preview": "/**\n * create-logger.js: Logger factory for winston logger instances.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE\n */\n"
  },
  {
    "path": "lib/winston/exception-handler.js",
    "chars": 6909,
    "preview": "/**\n * exception-handler.js: Object for handling uncaughtException events.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE"
  },
  {
    "path": "lib/winston/exception-stream.js",
    "chars": 1506,
    "preview": "/**\n * exception-stream.js: TODO: add file header handler.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE\n */\n\n'use stric"
  },
  {
    "path": "lib/winston/logger.js",
    "chars": 20521,
    "preview": "/**\n * logger.js: TODO: add file header description.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE\n */\n\n'use strict';\n\nc"
  },
  {
    "path": "lib/winston/profiler.js",
    "chars": 1418,
    "preview": "/**\n * profiler.js: TODO: add file header description.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE\n */\n\n'use strict';\n"
  },
  {
    "path": "lib/winston/rejection-handler.js",
    "chars": 6982,
    "preview": "/**\n * exception-handler.js: Object for handling uncaughtException events.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE"
  },
  {
    "path": "lib/winston/rejection-stream.js",
    "chars": 1353,
    "preview": "/**\n * rejection-stream.js: TODO: add file header handler.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE\n */\n\n'use stric"
  },
  {
    "path": "lib/winston/tail-file.js",
    "chars": 2700,
    "preview": "/**\n * tail-file.js: TODO: add file header description.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE\n */\n\n'use strict';"
  },
  {
    "path": "lib/winston/transports/console.js",
    "chars": 3842,
    "preview": "/* eslint-disable no-console */\n/*\n * console.js: Transport for outputting to the console.\n *\n * (C) 2010 Charlie Robbin"
  },
  {
    "path": "lib/winston/transports/file.js",
    "chars": 22206,
    "preview": "/* eslint-disable complexity,max-statements */\n/**\n * file.js: Transport for outputting to a local log file.\n *\n * (C) 2"
  },
  {
    "path": "lib/winston/transports/http.js",
    "chars": 7733,
    "preview": "/**\n * http.js: Transport for outputting to a json-rpcserver.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE\n */\n\n'use st"
  },
  {
    "path": "lib/winston/transports/index.d.ts",
    "chars": 2975,
    "preview": "// Type definitions for winston 3.0\n// Project: https://github.com/winstonjs/winston\n\n/// <reference types=\"node\" />\n\nim"
  },
  {
    "path": "lib/winston/transports/index.js",
    "chars": 909,
    "preview": "/**\n * transports.js: Set of all transports Winston knows about.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE\n */\n\n'use"
  },
  {
    "path": "lib/winston/transports/stream.js",
    "chars": 1785,
    "preview": "/**\n * stream.js: Transport for outputting to any arbitrary stream.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE\n */\n\n'"
  },
  {
    "path": "lib/winston.js",
    "chars": 4595,
    "preview": "/**\n * winston.js: Top-level include defining Winston.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENCE\n */\n\n'use strict';\n"
  },
  {
    "path": "package.json",
    "chars": 1866,
    "preview": "{\n\t\"name\": \"winston\",\n\t\"description\": \"A logger for just about everything.\",\n\t\"version\": \"3.19.0\",\n\t\"author\": \"Charlie R"
  },
  {
    "path": "publishing.md",
    "chars": 2715,
    "preview": "The release process here mostly follows along with the [vbump script](https://github.com/indexzero/vbump) that @indexzer"
  },
  {
    "path": "test/fixtures/.gitkeep",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "test/fixtures/keys/agent2-cert.pem",
    "chars": 729,
    "preview": "-----BEGIN CERTIFICATE-----\nMIIB7DCCAZYCCQC7gs0MDNn6MTANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJV\nUzELMAkGA1UECBMCQ0ExCzAJBgN"
  },
  {
    "path": "test/fixtures/keys/agent2-key.pem",
    "chars": 493,
    "preview": "-----BEGIN RSA PRIVATE KEY-----\nMIIBOgIBAAJBAMl2/Ba0XSm4ayi4C0rJ+tYtQu8O31VVXezkLJlf+6fVgdpVhYg5\nQlihlPUoiM/wOsDWQ1ALnNh"
  },
  {
    "path": "test/fixtures/logs/.gitkeep",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "test/globalSetup.js",
    "chars": 343,
    "preview": "const path = require('path');\nconst { rimraf } = require('rimraf');\n\nfunction cleanTestArtifacts() {\n  console.debug('\\n"
  },
  {
    "path": "test/helpers/handler-tests.js",
    "chars": 2779,
    "preview": "const assume = require('assume');\n\nconst helpers = require('.');\nconst winston = require('../../lib/winston');\n\nmodule.e"
  },
  {
    "path": "test/helpers/index.js",
    "chars": 6186,
    "preview": "/*\n * helpers.js: Test helpers for winston\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENSE\n *\n */\n\nconst assume = require("
  },
  {
    "path": "test/helpers/mocks/legacy-mixed-transport.js",
    "chars": 1531,
    "preview": "'use strict'\n\nconst events = require('events');\nconst util = require('util')\nconst Transport = require('../../../').Tran"
  },
  {
    "path": "test/helpers/mocks/legacy-transport.js",
    "chars": 1513,
    "preview": "'use strict'\n\nconst events = require('events');\nconst util = require('util')\nconst Transport = require('winston-compat')"
  },
  {
    "path": "test/helpers/mocks/mock-transport.js",
    "chars": 562,
    "preview": "const stream = require('stream')\nconst winston = require('../../../lib/winston');\n\n/**\n * Returns a new Winston transpor"
  },
  {
    "path": "test/helpers/scripts/colorize.js",
    "chars": 422,
    "preview": "/*\n * colorize.js: A test fixture for logging colorized messages\n *\n * (C) 2015 Tom Spencer\n * MIT LICENCE\n *\n */\n\nvar w"
  },
  {
    "path": "test/helpers/scripts/default-rejections.js",
    "chars": 612,
    "preview": "/*\n * default-rejectionss.js: A test fixture for logging rejections with the default winston logger.\n *\n * (C) 2011 Char"
  },
  {
    "path": "test/helpers/scripts/exit-on-error.js",
    "chars": 675,
    "preview": "/*\n * default-exceptions.js: A test fixture for logging exceptions with the default winston logger.\n *\n * (C) 2011 Charl"
  },
  {
    "path": "test/helpers/scripts/log-rejections.js",
    "chars": 599,
    "preview": "/*\n * log-rejections.js: A test fixture for logging rejections in winston.\n *\n * (C) 2011 Charlie Robbins\n * MIT LICENCE"
  },
  {
    "path": "test/helpers/scripts/unhandle-exceptions.js",
    "chars": 660,
    "preview": "/*\n * unhandle-exceptions.js: A test fixture for using `.unhandleExceptions()` winston.\n *\n * (C) 2011 Charlie Robbins\n "
  },
  {
    "path": "test/helpers/scripts/unhandle-rejections.js",
    "chars": 671,
    "preview": "/*\n * unhandle-rejections.js: A test fixture for using `.unhandleRejections()` winston.\n *\n * (C) 2011 Charlie Robbins\n "
  },
  {
    "path": "test/integration/formats.test.js",
    "chars": 1105,
    "preview": "/*\n * formats.test.js: Integration tests for winston.format\n *\n * (C) 2015 Charlie Robbins\n * MIT LICENSE\n *\n */\n\nvar pa"
  },
  {
    "path": "test/integration/logger.test.js",
    "chars": 464,
    "preview": "const assume = require('assume');\nconst winston = require('../../lib/winston');\n\nconst Logger = winston.Logger;\n\ndescrib"
  },
  {
    "path": "test/jest.config.integration.js",
    "chars": 232,
    "preview": "const baseConfig = require('../jest.config');\n\n/**\n * @type {import('@jest/types').Config.InitialOptions}\n */\nmodule.exp"
  },
  {
    "path": "test/jest.config.unit.js",
    "chars": 250,
    "preview": "const baseConfig = require('../jest.config');\n\n/**\n * @type {import('@jest/types').Config.InitialOptions}\n */\nmodule.exp"
  },
  {
    "path": "test/tsconfig.json",
    "chars": 492,
    "preview": "{\n  \"compilerOptions\": {\n    \"module\": \"commonjs\",\n    \"lib\": [\n      \"es6\"\n    ],\n    \"target\": \"es6\",\n    \"noImplicitA"
  },
  {
    "path": "test/typescript-definitions.ts",
    "chars": 1749,
    "preview": "import * as winston from '../index';\n\nlet logger: winston.Logger = winston.createLogger({\n    level: 'info',\n    format:"
  },
  {
    "path": "test/unit/formats/errors.test.js",
    "chars": 6947,
    "preview": "/*\n * errors.test.js: E2E Integration tests of `new Error()` handling\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENSE\n *\n "
  },
  {
    "path": "test/unit/winston/config/config.test.js",
    "chars": 536,
    "preview": "/*\n * config.test.js: Tests for winston.config\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENSE\n *\n */\n\nconst assume = requ"
  },
  {
    "path": "test/unit/winston/container.test.js",
    "chars": 2970,
    "preview": "/*\n * container-test.js: Tests for the Container object\n *\n * (C) 2011 Charlie Robbins\n * MIT LICENSE\n *\n */\n\nconst assu"
  },
  {
    "path": "test/unit/winston/create-logger.test.js",
    "chars": 3455,
    "preview": "const winston = require(\"../../../lib/winston\");\nconst assume = require(\"assume\");\nconst isStream = require(\"is-stream\")"
  },
  {
    "path": "test/unit/winston/exception-handler.test.js",
    "chars": 456,
    "preview": "/*\n * exception-test.js: Tests for exception data gathering in winston.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENSE\n *"
  },
  {
    "path": "test/unit/winston/exception-stream.test.js",
    "chars": 2741,
    "preview": "/*\n * exception-test.js: Tests for exception data gathering in winston.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENSE\n *"
  },
  {
    "path": "test/unit/winston/log-exception.test.js",
    "chars": 6043,
    "preview": "/*\n * log-exception.test.js: Tests for exception data gathering in winston.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENS"
  },
  {
    "path": "test/unit/winston/logger-legacy.test.js",
    "chars": 3645,
    "preview": "/*\n * logger-legacy.test.js: Tests for Legacy APIs of winston < 3.0.0\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENSE\n *\n "
  },
  {
    "path": "test/unit/winston/logger.test.js",
    "chars": 36077,
    "preview": "/*\n * logger.test.js: Tests for instances of the winston Logger\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENSE\n *\n */\n\n'u"
  },
  {
    "path": "test/unit/winston/profiler.test.js",
    "chars": 1727,
    "preview": "/*\n * profiler.js: Tests for exception simple profiling.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENSE\n *\n */\n\nconst ass"
  },
  {
    "path": "test/unit/winston/rejection-handler.test.js",
    "chars": 466,
    "preview": "/*\n * rejection-test.js: Tests for rejection data gathering in winston.\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENSE\n *"
  },
  {
    "path": "test/unit/winston/tail-file.test.js",
    "chars": 2294,
    "preview": "/*\n * tail-file.test.js: Tests for lib/winston/tail-file.js\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENSE\n *\n */\n\nconst "
  },
  {
    "path": "test/unit/winston/transports/00-file-stress.test.js",
    "chars": 5036,
    "preview": "'use strict';\n\n/*\n * file-stress.test.js: Tests for stressing File transport: volume, ambient event loop lag.\n *\n * (C) "
  },
  {
    "path": "test/unit/winston/transports/console.test.js",
    "chars": 6242,
    "preview": "'use strict';\n\n/*\n * console-test.js: Tests for instances of the Console transport\n *\n * (C) 2010 Charlie Robbins\n * MIT"
  },
  {
    "path": "test/unit/winston/transports/error.test.js",
    "chars": 3246,
    "preview": "const winston = require('../../../../lib/winston');\nconst assume = require('assume');\n\n// https://github.com/winstonjs/w"
  },
  {
    "path": "test/unit/winston/transports/file-create-dir.test.js",
    "chars": 1230,
    "preview": "'use strict';\n\nconst fs = require('fs');\nconst assert = require('assert');\nconst path = require('path');\nconst winston ="
  },
  {
    "path": "test/unit/winston/transports/file.test.js",
    "chars": 18619,
    "preview": "'use strict';\n\n/* eslint-disable no-sync */\nconst assert = require('assert');\nconst { rimraf } = require('rimraf');\ncons"
  },
  {
    "path": "test/unit/winston/transports/http.test.js",
    "chars": 4297,
    "preview": "/*\n * http-test.js: Tests for instances of the HTTP transport\n *\n * MIT LICENSE\n */\n\nconst http = require('http');\nconst"
  },
  {
    "path": "test/unit/winston/transports/stream.test.js",
    "chars": 1323,
    "preview": "'use strict';\n\nconst path = require('path');\nconst writeable = require('../../../helpers').writeable;\nconst { MESSAGE } "
  },
  {
    "path": "test/unit/winston/winston.test.js",
    "chars": 3160,
    "preview": "/*\n * winston.test.js: Tests for instances of the winston Logger\n *\n * (C) 2010 Charlie Robbins\n * MIT LICENSE\n *\n */\n\nc"
  },
  {
    "path": "tsconfig.json",
    "chars": 497,
    "preview": "{\n  \"compilerOptions\": {\n    \"module\": \"commonjs\",\n    \"lib\": [\n      \"es6\"\n    ],\n    \"target\": \"es6\",\n    \"noImplicitA"
  }
]

About this extraction

This page contains the full source code of the winstonjs/winston GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 114 files (413.0 KB), approximately 108.1k tokens, and a symbol index with 169 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!