-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
98 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,88 @@ | ||
'use strict'; | ||
|
||
require('date-utils'); | ||
var Acho = require('./index.js'); | ||
var setDateout = require('set-dateout'); | ||
|
||
var base = new Acho({ | ||
align: true | ||
}); | ||
|
||
var diff = new Acho({ | ||
diff: true | ||
}); | ||
|
||
var label = new Acho({ | ||
align: false, | ||
keyword: 'worker#1' | ||
}); | ||
|
||
var colors = new Acho({ | ||
color: false | ||
}); | ||
|
||
var acho = new Acho({ | ||
level: 'silly', | ||
color: true | ||
var visit = new Acho({ | ||
keyword: 'visit' | ||
}); | ||
|
||
acho.error('error message'); | ||
acho.warning('warning message'); | ||
acho.success('success message'); | ||
acho.info('info message'); | ||
acho.verbose('verbose message'); | ||
acho.debug('debug message'); | ||
acho.silly('silly message'); | ||
var getStep = (function() { | ||
var start = 0; | ||
return function(value) { | ||
if (value) start += value; | ||
else ++start; | ||
return start; | ||
}; | ||
})(); | ||
|
||
var messageTimeout = (function() { | ||
return function(level, message, logger, time) { | ||
setDateout(function() { | ||
logger[level](message); | ||
}, new Date().add({seconds: getStep(0.8)})); | ||
}; | ||
})(); | ||
|
||
var lineBreakTimeout = (function() { | ||
return function(time) { | ||
setDateout(function() { | ||
console.log(); | ||
}, new Date().add({seconds: getStep(time || 0.2)})); | ||
}; | ||
})(); | ||
|
||
messageTimeout('info', 'Simple', base); | ||
messageTimeout('success', 'Tiny', base); | ||
messageTimeout('verbose', 'Customizable', base); | ||
messageTimeout('silly', 'Logger for NodeJS and Browser', base); | ||
messageTimeout('warn', 'in less than...', base); | ||
messageTimeout('error', '10KB!.', base); | ||
|
||
lineBreakTimeout(1); | ||
|
||
messageTimeout('info', 'Do you wanna to know more?', base); | ||
|
||
lineBreakTimeout(); | ||
|
||
messageTimeout('success', 'support diff', diff); | ||
messageTimeout('success', 'between messages', diff); | ||
|
||
lineBreakTimeout(); | ||
|
||
messageTimeout('warn', 'adapt the logger label', label); | ||
messageTimeout('warn', 'easily', label); | ||
|
||
lineBreakTimeout(); | ||
|
||
messageTimeout('error', 'automatically color disabled', colors); | ||
messageTimeout('error', 'under production', colors); | ||
|
||
lineBreakTimeout(); | ||
|
||
messageTimeout('silly', 'and more more more...', base); | ||
messageTimeout('debug', 'string interpolation', base); | ||
messageTimeout('verbose', 'logs align', base); | ||
messageTimeout('info', 'custom levels and transports', base); | ||
|
||
lineBreakTimeout(); | ||
|
||
messageTimeout('success', 'https://github.com/Kikobeats/acho', visit); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters