Skip to content

Commit

Permalink
1491 - Custom log levels can be silent unless level is also specified (
Browse files Browse the repository at this point in the history
…#1)

* Bump rimraf from 3.0.2 to 5.0.5  (winstonjs#2357)

* Bump rimraf from 3.0.2 to 5.0.5

Bumps [rimraf](https://github.com/isaacs/rimraf) from 3.0.2 to 5.0.5.
- [Changelog](https://github.com/isaacs/rimraf/blob/main/CHANGELOG.md)
- [Commits](isaacs/rimraf@v3.0.2...v5.0.5)

---
updated-dependencies:
- dependency-name: rimraf
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: rimraf is not a function

* fix: rimraf is not a function

* fix: rimraf is not a function

* fix: done() is not called on mocha hooks

* fix: done() invoked with non-Error

* fix: resolution method is overspecified

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump @colors/colors packgae to 1.6.0 (winstonjs#2353)

* Bump actions/checkout from 3 to 4 (winstonjs#2346)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump split2 from 4.1.0 to 4.2.0 (winstonjs#2336)

Bumps [split2](https://github.com/mcollina/split2) from 4.1.0 to 4.2.0.
- [Release notes](https://github.com/mcollina/split2/releases)
- [Commits](mcollina/split2@v4.1.0...v4.2.0)

---
updated-dependencies:
- dependency-name: split2
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 3.11.0

* Update dependencies

* Remove nonexistent Logger methods from types

* chore(README.md): adds documentation around coloring json formatted logs

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jack Nolddor <1280022+nolddor@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Halsall <james.t.halsall@googlemail.com>
Co-authored-by: DABH <DABH@users.noreply.github.com>
Co-authored-by: Phillip Huang <phillip@vanta.com>
Co-authored-by: Alejandro Campos <camposalejandrofabian@gmail.com>
  • Loading branch information
7 people authored Nov 13, 2023
1 parent 6e0444c commit 878ea36
Show file tree
Hide file tree
Showing 10 changed files with 1,727 additions and 941 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- 18
- 20
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -675,10 +675,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 })
);
```
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
7 changes: 0 additions & 7 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,6 @@ declare namespace winston {
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
Expand Down
2,618 changes: 1,700 additions & 918 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "winston",
"description": "A logger for just about everything.",
"version": "3.10.0",
"version": "3.11.0",
"author": "Charlie Robbins <charlie.robbins@gmail.com>",
"maintainers": [
"David Hyde <dabh@alumni.stanford.edu>"
Expand All @@ -25,7 +25,7 @@
],
"dependencies": {
"@dabh/diagnostics": "^2.0.2",
"@colors/colors": "1.5.0",
"@colors/colors": "^1.6.0",
"async": "^3.2.3",
"is-stream": "^2.0.0",
"logform": "^2.4.0",
Expand All @@ -49,7 +49,7 @@
"hock": "^1.4.1",
"mocha": "8.1.3",
"nyc": "^15.1.0",
"rimraf": "^3.0.2",
"rimraf": "^5.0.5",
"split2": "^4.1.0",
"std-mocks": "^1.0.1",
"through2": "^4.0.2",
Expand Down
4 changes: 2 additions & 2 deletions test/unit/winston/transports/01-file-maxsize.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* MIT LICENSE
*
*/
const rimraf = require('rimraf');
const { rimraf } = require('rimraf');
const fs = require('fs');
const path = require('path');
const assume = require('assume');
Expand All @@ -18,7 +18,7 @@ const MESSAGE = Symbol.for('message');
// Remove all log fixtures
//
function removeFixtures(done) {
rimraf(path.join(testLogFixturesPath, 'testmaxsize*'), done);
rimraf(path.join(testLogFixturesPath, 'testmaxsize*')).then(() => done());
}

describe('File (maxsize)', function () {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/winston/transports/file-archive.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/* eslint-disable no-sync */
const assert = require('assert');
const rimraf = require('rimraf');
const { rimraf } = require('rimraf');
const fs = require('fs');
const path = require('path');
const winston = require('../../../../lib/winston');
Expand All @@ -20,7 +20,7 @@ const { MESSAGE } = require('triple-beam');
// Remove all log fixtures
//
function removeFixtures(done) {
rimraf(path.join(testLogFixturesPath, 'testarchive*'), done);
rimraf(path.join(testLogFixturesPath, 'testarchive*')).then(() => done());
}


Expand Down
4 changes: 2 additions & 2 deletions test/unit/winston/transports/file-create-dir.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ const fs = require('fs');
const assert = require('assert');
const path = require('path');
const winston = require('../../../../lib/winston');
const rimraf = require("rimraf");
const { rimraf } = require('rimraf');

/* eslint-disable no-sync */

describe('winston/transports/file/createLogDir', function () {
const logDir = path.resolve(__dirname, '../../../fixtures/temp_logs');

beforeEach(function () {
rimraf(logDir, (err) => {
return rimraf(logDir).catch(err => {
if (err){
console.log('Error encountered when removing `temp_logs` dir')
console.log(err);
Expand Down
4 changes: 2 additions & 2 deletions test/unit/winston/transports/file-rotationFormat.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const fs = require('fs');
const { MESSAGE } = require('triple-beam');
const split = require('split2');
const assume = require('assume');
const rimraf = require('rimraf');
const { rimraf } = require('rimraf');
const testFileFixturesPath = path.join(
__dirname,
'..',
Expand All @@ -21,7 +21,7 @@ const testFileFixturesPath = path.join(
// Remove all log fixtures
//
function removeFixtures(done) {
rimraf(path.join(testFileFixturesPath, 'rotation*'), done);
rimraf(path.join(testFileFixturesPath, 'rotation*')).then(() => done());
}

// Validate Filename according to rotation
Expand Down
4 changes: 2 additions & 2 deletions test/unit/winston/transports/file-tailrolling.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-sync */
const assert = require('assert');
const rimraf = require('rimraf');
const { rimraf } = require('rimraf');
const fs = require('fs');
const path = require('path');
const winston = require('../../../../lib/winston');
Expand All @@ -12,7 +12,7 @@ const { MESSAGE } = require('triple-beam');
// Remove all log fixtures
//
function removeFixtures(done) {
rimraf(path.join(testLogFixturesPath, 'testtailrollingfiles*'), done);
rimraf(path.join(testLogFixturesPath, 'testtailrollingfiles*')).then(() => done());
}


Expand Down

0 comments on commit 878ea36

Please sign in to comment.