Skip to content

Commit

Permalink
INFO log level as an alias for LOG
Browse files Browse the repository at this point in the history
  • Loading branch information
patapizza committed Jun 1, 2016
1 parent cf45286 commit 39b2b9f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- INFO level as an alias for LOG

## v3.3.2

- allows for overriding API version, by setting `WIT_API_VERSION`
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ const Wit = require('node-wit').Wit;
const client = new Wit(token, actions);
```

The `logger` object should implement the methods `debug`, `log`, `warn` and `error`.
The `logger` object should implement the methods `debug`, `log`/`info`, `warn` and `error`.
All methods take a single parameter `message`.

For convenience, we provide a `Logger`, taking a log level parameter (provided as `logLevels`).
The following levels are defined: `DEBUG`, `LOG`, `WARN`, `ERROR`.
The following levels are defined: `DEBUG`, `LOG`/`INFO`, `WARN`, `ERROR`.

Example:
```js
Expand Down
3 changes: 3 additions & 0 deletions lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
const LEVELS = {
DEBUG: 0,
LOG: 1,
INFO: 1,
WARN: 2,
ERROR: 3,
};
Expand All @@ -28,6 +29,8 @@ const Logger = function(lvl) {
}
};

this.info = this.log;

this.warn = (message) => {
if (LEVELS.WARN >= this.level) {
log(message, 'warn');
Expand Down

0 comments on commit 39b2b9f

Please sign in to comment.