Skip to content

Commit

Permalink
Merge branch 'master' of github.com:winstonjs/winston into fix-bad-test
Browse files Browse the repository at this point in the history
  • Loading branch information
fearphage committed Aug 11, 2024
2 parents 5ea609e + b270c4e commit d874efd
Show file tree
Hide file tree
Showing 33 changed files with 3,187 additions and 7,764 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ jobs:
strategy:
matrix:
node:
- 12
- 14
- 16
- 18
- 20
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install Dependencies
Expand All @@ -40,7 +40,7 @@ jobs:
- name: Test Coverage
run: npm run test:coverage
- name: Report test coverage to Coveralls.io
if: matrix.node == '16'
if: matrix.node == '20'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .nycrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ reporter:
check-coverage: true
branches: 61.51
lines: 70.85
functions: 73.21
statements: 70.54
functions: 70.00
statements: 70.54
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# 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
Expand Down
56 changes: 44 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ transports may produce a high memory usage issue.
* [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)

Expand Down Expand Up @@ -148,7 +149,7 @@ const logger = winston.createLogger({
});
```

A logger accepts the following parameters:
A logger accepts the following parameters:

| Name | Default | Description |
| ------------- | --------------------------- | --------------- |
Expand Down Expand Up @@ -226,6 +227,7 @@ const logger = winston.createLogger({

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

Expand Down Expand Up @@ -259,7 +261,7 @@ Several of the formats in `logform` itself add additional properties:
| `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
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.
Expand Down Expand Up @@ -289,7 +291,7 @@ console.log(SPLAT === Symbol.for('splat'));
// true
```

> **NOTE:** any `{ message }` property in a `meta` object provided will
> **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':
>
Expand Down Expand Up @@ -379,10 +381,10 @@ const logger = createLogger({
transports: [new transports.Console()]
});

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

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

// info: test message first second {number: 123}
Expand Down Expand Up @@ -449,7 +451,7 @@ method: `transform(info, opts)` and return the mutated `info`:
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
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
Expand Down Expand Up @@ -674,10 +676,21 @@ To colorize the standard logging level add
```js
winston.format.combine(
winston.format.colorize(),
winston.format.json()
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 })
);
```
where `winston.format.json()` is whatever other formatter you want to use. The `colorize` formatter must come before any formatters adding text you wish to color.

## Transports

Expand Down Expand Up @@ -764,11 +777,11 @@ const logger = winston.createLogger({
level: 'error',
format: winston.format.json()
}),
new transports.Http({
new winston.transports.Http({
level: 'warn',
format: winston.format.json()
}),
new transports.Console({
new winston.transports.Console({
level: 'info',
format: winston.format.combine(
winston.format.colorize(),
Expand Down Expand Up @@ -898,7 +911,7 @@ logger.exitOnError = ignoreEpipe;

### Handling Uncaught Promise Rejections with winston

With `winston`, it is possible to catch and log `uncaughtRejection` events
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:

Expand Down Expand Up @@ -1186,6 +1199,25 @@ 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
Expand Down Expand Up @@ -1232,4 +1264,4 @@ npm test
[Charlie Robbins]: http://github.com/indexzero
[Jarrett Cruger]: https://github.com/jcrugzz
[David Hyde]: https://github.com/dabh
[Chris Alderson]: https://github.com/chrisalderson
[Chris Alderson]: https://github.com/chrisalderson
4 changes: 2 additions & 2 deletions docs/publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ The release process here mostly follows along with the [vbump script](https://gi
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 using GitHub's compare tool ([example here](https://github.com/winstonjs/winston/compare/v3.6.0...master)).
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 ges updated: at the top level and under the empty-string entry of packages.
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.
Expand Down
Loading

0 comments on commit d874efd

Please sign in to comment.