Skip to content

feat(client): delete none and warning from clientLogLevel #1998

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

Merged
merged 1 commit into from
Jun 10, 2019
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
12 changes: 0 additions & 12 deletions client-src/default/utils/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ const ERROR = 'error';
const DEBUG = 'debug';
const TRACE = 'trace';
const SILENT = 'silent';
// deprecated
// TODO: remove these at major released
// https://github.com/webpack/webpack-dev-server/pull/1825
const WARNING = 'warning';
const NONE = 'none';

// Set the default log level
log.setDefaultLevel(INFO);
Expand All @@ -26,13 +21,6 @@ export function setLogLevel(level) {
case TRACE:
log.setLevel(level);
break;
// deprecated
case WARNING:
// loglevel's warning name is different from webpack's
log.setLevel('warn');
break;
// deprecated
case NONE:
case SILENT:
log.disableAll();
break;
Expand Down
11 changes: 1 addition & 10 deletions lib/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,7 @@
]
},
"clientLogLevel": {
"enum": [
"info",
"warn",
"error",
"debug",
"trace",
"silent",
"none",
"warning"
]
"enum": ["info", "warn", "error", "debug", "trace", "silent"]
},
"compress": {
"type": "boolean"
Expand Down
3 changes: 0 additions & 3 deletions test/client/utils/__snapshots__/log.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,5 @@ Array [
Array [
"trace",
],
Array [
"warn",
],
]
`;
10 changes: 4 additions & 6 deletions test/client/utils/log.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('log', () => {
});

test('should set log level via setLogLevel', () => {
['info', 'warn', 'error', 'debug', 'trace', 'warning'].forEach((level) => {
['info', 'warn', 'error', 'debug', 'trace'].forEach((level) => {
setLogLevel(level);
});

Expand All @@ -44,14 +44,12 @@ describe('log', () => {
).toMatchSnapshot();
});

test('should set none and silent via setLogLevel', () => {
['none', 'silent'].forEach((level) => {
setLogLevel(level);
});
test('should set silent via setLogLevel', () => {
setLogLevel('silent');

expect(
logMock.getLogger.mock.results[0].value.disableAll.mock.results
).toHaveLength(2);
).toHaveLength(1);
});

test('should output exception log when the level is unknown', () => {
Expand Down
15 changes: 2 additions & 13 deletions test/options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,8 @@ describe('options', () => {
failure: [false],
},
clientLogLevel: {
success: [
'silent',
'info',
'error',
'warn',
'trace',
'debug',
// deprecated
'none',
// deprecated
'warning',
],
failure: ['whoops!'],
success: ['silent', 'info', 'error', 'warn', 'trace', 'debug'],
failure: ['whoops!', 'none', 'warning'],
},
compress: {
success: [true],
Expand Down