From 5c1654deecc9062730301b95d00a6b8a0a948f1e Mon Sep 17 00:00:00 2001 From: Kiko Beats Date: Sat, 9 May 2015 23:42:21 +0200 Subject: [PATCH] update warning message into warn --- README.md | 18 +++++++++--------- lib/Acho.coffee | 5 +++-- lib/Default.coffee | 2 +- test/test.coffee | 4 ++-- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index dcb96ab..e806af0 100755 --- a/README.md +++ b/README.md @@ -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`. @@ -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: @@ -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>) diff --git a/lib/Acho.coffee b/lib/Acho.coffee index e907e9a..2bc5b2b 100644 --- a/lib/Acho.coffee +++ b/lib/Acho.coffee @@ -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 @@ -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) -> diff --git a/lib/Default.coffee b/lib/Default.coffee index d6a4e89..1caf14b 100644 --- a/lib/Default.coffee +++ b/lib/Default.coffee @@ -15,7 +15,7 @@ module.exports = error: level : 0 color : 'red' - warning: + warn: level : 1 color : 'yellow' success: diff --git a/test/test.coffee b/test/test.coffee index 662053a..d8fdb1a 100755 --- a/test/test.coffee +++ b/test/test.coffee @@ -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' @@ -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'