Browse files

update to 0.2.1

fixed spell missing
  • Loading branch information...
1 parent 71f05f0 commit 4e649e083c719199fd08600d9a4b615902cd4973 @baryon committed Mar 5, 2012
Showing with 22 additions and 4 deletions.
  1. +5 −1 README.md
  2. +2 −2 lib/console.js
  3. +1 −1 package.json
  4. +14 −0 test/test.js
View
6 README.md
@@ -127,7 +127,7 @@ format tag:
* pos: postion
* path: file's path
* method: method name of caller
-* stack: call statck
+* stack: call stack
About [Date Format](http://blog.stevenlevithan.com/archives/date-time-format)
@@ -276,6 +276,10 @@ console.log('\n\n\npress ctrl-c to exit');
## History
+### 0.2.1
+
+* fix spell missing
+
### 0.2.0
* Add more examples.
View
4 lib/console.js
@@ -36,10 +36,10 @@ module.exports = (function() {
try {
throw new Error();
} catch (e) {
- data.statck = e.stack.split('\n').slice(3);
+ data.stack = e.stack.split('\n').slice(3);
var reg = /at\s+(.*)\s+\((.*):(\d*):(\d*)\)/ig;
- var sp = reg.exec(data.statck[0]);
+ var sp = reg.exec(data.stack[0]);
if (sp && sp.length === 5) {
data.method = sp[1];
data.path = sp[2];
View
2 package.json
@@ -2,7 +2,7 @@
"name": "tracer",
"description": "A powerful and customizable logging library for node.js. support color console with timestamp, line number, method name, file name and call stack. you can set transport to file, stream, database(ex: mongodb and clouddb, simpledb). keywords: log, logger, trace ",
"homepage": "http://github.com/baryon/tracer",
- "version": "0.2.0",
+ "version": "0.2.1",
"author": "LI Long <lilong@gmail.com>",
"dependencies": {
"dateformat": "1.0.2-1.2.3",
View
14 test/test.js
@@ -23,3 +23,17 @@ exports["simple console message"] = function() {
var o = logger.debug('hello');
assert.equal(o.output, '\u001b[34mhello\u001b[39m');
}
+
+exports["console log method"] = function() {
+ var logger = require('../').console({
+ format : "{{message}}",
+ transpot : function(data) {
+ console.log(data.output);
+ return data;
+ }
+ });
+ var o = logger.log('hello %s %d', 'world', 123);
+ assert.equal(o['title'], 'log');
+ assert.equal(o['file'], 'test.js');
+ assert.equal(o['output'], 'hello world 123');
+}

0 comments on commit 4e649e0

Please sign in to comment.