Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1491 - Custom log levels can be silent unless level is also specified #1

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]>",
"maintainers": [
"David Hyde <[email protected]>"
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