From 3d02acaf202423bf818d9e71aa42f45093dcaf8d Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Fri, 5 Dec 2014 15:24:38 -0400 Subject: [PATCH] Document resin/log --- lib/resin/log/log.coffee | 58 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/lib/resin/log/log.coffee b/lib/resin/log/log.coffee index ee29cb58..8d51ed0b 100644 --- a/lib/resin/log/log.coffee +++ b/lib/resin/log/log.coffee @@ -1,28 +1,82 @@ _ = require('lodash') +# @nodoc isQuiet = false +# Change log quietness +# +# @param {Boolean} quiet quietness +# +# @note If quiet is true, only resin.log.info will be quieted +# +# @example Set quietness +# resin.log.setQuiet(true) +# exports.setQuiet = (quiet) -> isQuiet = !!quiet +# Check quietness +# +# @return {Boolean} is quiet +# +# @example Check quietness +# resin.log.isQuiet() +# exports.isQuiet = -> return isQuiet -# stderr +# Log an error +# +# @param {...String} message message +# +# @example Log an error +# resin.log.error('Something went wrong!') +# exports.error = (args...) -> console.error.apply(null, args) +# Log a warning +# +# @param {...String} message message +# +# @example Log a warning +# resin.log.warning('Something might happened!') +# exports.warning = (args...) -> console.warn.apply(null, args) -# stdout +# Log info +# +# @param {...String} message message +# +# @example Log info +# resin.log.info('Look!') +# exports.info = (args...) -> return if exports.isQuiet() console.info.apply(null, args) +# Log out +# +# @param {...String} message message +# +# @note This will not be quieted even if setQuiet is set to true +# +# @example Log out +# resin.log.out('Hello World!') +# exports.out = (args...) -> console.log.apply(null, args) +# Log an array +# +# It will iterate trough the array, calling logFunction for every item +# +# @param {Array} array array +# @param {Function} logFunction log function (e.g: resin.log.info) +# +# @throw Will throw if logFunction is not a function +# exports.array = (array, logFunction) -> return if not array?