Skip to content
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
4 changes: 4 additions & 0 deletions src/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ export class Logger {
this.log('warning', message, ...args);
}

warn(message, ...args) {
this.log('warning', message, ...args);
}

info(message, ...args) {
this.log('info', message, ...args);
}
Expand Down
15 changes: 12 additions & 3 deletions test/logger.loglevel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ test('Test all log levels', t => {
logger.warning('Should log at warning level');
});

const warnOutput = captureConsole('warn', () => {
logger.warn('Should log at warning level');
});

const errorOutput = captureConsole('error', () => {
logger.error('Should log at error level');
});
Expand All @@ -181,21 +185,26 @@ test('Test all log levels', t => {

t.true(
infoOutput.includes('Should log at info level'),
'Info messages should be logged at trace level'
'Info messages should be logged at info level'
);

t.true(
warningOutput.includes('Should log at warning level'),
'Warning messages should be logged at warning level'
);

t.true(
warnOutput.includes('Should log at warning level'),
'Warning messages should be logged at trace level'
);

t.true(
errorOutput.includes('Should log at error level'),
'Error messages should be logged at trace level'
'Error messages should be logged at error level'
);

t.true(
criticalOutput.includes('Should log at critical level'),
'Critical messages should be logged at trace level'
'Critical messages should be logged at critical level'
);
});