Skip to content

Commit

Permalink
fix: Options argument from required to optional (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshinorin committed Nov 4, 2022
1 parent d023800 commit 42b66e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,22 @@ const log = require('hexo-log')({
debug: false,
silent: false
});
log.info('Hello world');

// v4.x.x
const log = require('hexo-log').default({
debug: false,
silent: false
});
log.info('Hello world');

// v4.x.x (ES Module)
import { logger } from 'hexo-log';

const log = logger({
debug: false,
silent: false
});
log.info('Hello world');
```

Expand Down
4 changes: 2 additions & 2 deletions lib/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class Logger {
}
}

export default function createLogger(options: Options) {
export default function createLogger(options: Options = {}) {
const logger = new Logger(options);

logger.d = logger.debug;
Expand All @@ -161,4 +161,4 @@ export default function createLogger(options: Options) {
return logger;
}

export const logger = (option: Options) => createLogger(option);
export const logger = (option: Options = {}) => createLogger(option);

0 comments on commit 42b66e6

Please sign in to comment.