Skip to content

Commit

Permalink
Adjusting Example
Browse files Browse the repository at this point in the history
- Converting example to ES5
- Updating example to conform to other examples
- Updating example to have custom warning message
  • Loading branch information
Tyharo1 committed Feb 11, 2020
1 parent d348807 commit 5a92f70
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions README.md
Expand Up @@ -1152,12 +1152,18 @@ Defaults:
- _logger_: sets the logging method. Default is the global `console` object that should have methods `log`, `warn` and `error`. Option values:
- custom logger - it should have methods `log`, `warn` and `error`. If any of these methods is missing an exception will be thrown.
```javascript
var ajv = new AJV.default({
var ajv = new Ajv({
logger: {
log: log => console.log(log),
warn: () => null,
error: error => console.error(error),
},
log: function log(_log) {
return console.log(_log);
},
warn: function warn(_warn) {
return console.warn("Custom Warning: ".concat(_warn));
},
error: function error(_error) {
return console.error(_error);
}
}
});
```
- `false` - logging is disabled.
Expand Down

0 comments on commit 5a92f70

Please sign in to comment.