Skip to content

Commit

Permalink
feat(client): delete none and warning from clientLogLevel (#1998)
Browse files Browse the repository at this point in the history
ISSUE: #1901
  • Loading branch information
hiroppy committed Jun 10, 2019
1 parent 6751764 commit 4e2acca
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 44 deletions.
12 changes: 0 additions & 12 deletions client-src/default/utils/log.js
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
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
Expand Up @@ -19,8 +19,5 @@ Array [
Array [
"trace",
],
Array [
"warn",
],
]
`;
10 changes: 4 additions & 6 deletions test/client/utils/log.test.js
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
Expand Up @@ -55,19 +55,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

0 comments on commit 4e2acca

Please sign in to comment.