Skip to content

Commit

Permalink
update warning message into warn
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed May 9, 2015
1 parent 330b4d0 commit 5c1654d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ and later add it to your HTML:

Acho exports itself according to UMD best practices, which means that no matter where you are using the library, you get a version tailored for your environment.

If you're using a module loader (or Node), simple require the library as you would any other module.
If you're using a module loader (or Node), simple require the library as you would any other module.

If you're using a browser, the library falls back to attaching itself to window as the global `Acho`.

Expand Down Expand Up @@ -128,12 +128,12 @@ You can completely customize the library to your requirements: changes colors, a
Establishing the loglevel is a good way to filter out undesired information from output. The available levels are:

- `error`: Display calls to `.error()` messages.
- `warning`: Display calls from `.error()`, `.warning()` messages.
- `success`: Display calls from `.error()`, `.warning()`, `success()` messages.
- `info`: Display calls from `.error()`, `.warning()`, `success()`, `info()` messages.
- `verbose`: Display calls from `.error()`, `.warning()`, `success()`, `info()`, `verbose()` messages.
- `debug`: Display calls from `.error()`, `.warning()`, `success()`, `info()`, `verbose()`, `debug()` messages.
- `silly`: Display calls from `.error()`, `.warning()`, `success()`, `info()`, `verbose()`, `debug()`, `silly()` messages.
- `warn`: Display calls from `.error()`, `.warn()` messages.
- `success`: Display calls from `.error()`, `.warn()`, `success()` messages.
- `info`: Display calls from `.error()`, `.warn()`, `success()`, `info()` messages.
- `verbose`: Display calls from `.error()`, `.warn()`, `success()`, `info()`, `verbose()` messages.
- `debug`: Display calls from `.error()`, `.warn()`, `success()`, `info()`, `verbose()`, `debug()` messages.
- `silly`: Display calls from `.error()`, `.warn()`, `success()`, `info()`, `verbose()`, `debug()`, `silly()` messages.
- `silent`: Avoid all output.

The default log level is `info`. You can define it in the the constructor:
Expand Down Expand Up @@ -205,9 +205,9 @@ Store a message of given `type` internally and also output it.

Output a `error` message.

### .warning({String} <message>)
### .warn({String} <message>)

Output a `warning` message.
Output a `warn` message.

### .success({String} <message>)

Expand Down
5 changes: 3 additions & 2 deletions lib/Acho.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ DEFAULT = require './Default'
exists = require 'existential-default'

module.exports = class Acho

constructor: (options = {}) ->
@color = exists options.color, DEFAULT.COLOR
@level = exists options.level, DEFAULT.LEVEL
Expand Down Expand Up @@ -34,8 +35,8 @@ module.exports = class Acho
@printLine 'error', message
this

warning: (message) ->
@printLine 'warning', message
warn: (message) ->
@printLine 'warn', message
this

success: (message) ->
Expand Down
2 changes: 1 addition & 1 deletion lib/Default.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports =
error:
level : 0
color : 'red'
warning:
warn:
level : 1
color : 'yellow'
success:
Expand Down
4 changes: 2 additions & 2 deletions test/test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe 'Acho ::', ->
@acho.messages.error.length.should.be.equal 2

it 'print a normal message', ->
@acho.warning 'warning message'
@acho.warn 'warn message'

it 'change the color behavior', ->
@acho.types.error.color = 'red bold'
Expand All @@ -36,7 +36,7 @@ describe 'Acho ::', ->
describe 'default colors ::', ->
acho = new Acho level:'silly', color: true
acho.error 'error message'
acho.warning 'warning message'
acho.warn 'warn message'
acho.success 'success message'
acho.info 'info message'
acho.verbose 'verbose message'
Expand Down

0 comments on commit 5c1654d

Please sign in to comment.