Skip to content

Commit

Permalink
feat: add filter option to InteractiveWriter (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
zamotany committed Feb 6, 2020
1 parent 6c82158 commit 5698be5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ export class InteractiveWriter extends Writer {
private running: boolean = false;
private messageMaxLength: number;

constructor() {
super();
constructor({ filter }: { filter?: FilterConfig } = {}) {
super({ filter });
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { default: _, ...spinnerTypes } = spinners;
const longestSpinnerFrameLength = Object.values(
Expand Down
9 changes: 8 additions & 1 deletion test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,16 @@ describe('cli-tag-logger', () => {
startSpinner,
stopSpinner,
updateSpinner,
} = log.composeWriters(new log.InteractiveWriter());
} = log.composeWriters(
new log.InteractiveWriter({
filter: {
exclude: 'debug',
},
})
);

print('message 1');
print(log.debug`should not be logged`);

startSpinner('start', { interval: 5 });

Expand Down

0 comments on commit 5698be5

Please sign in to comment.