CrabDude / trycatch

An asynchronous domain-based exception handler with long stack traces for node.js
MIT License
246 stars 17 forks source link

What do the colors mean? #11

Closed Raynos closed 11 years ago

Raynos commented 12 years ago

They look random.

Can we use them for something useful like differentiating node core, node_modules and my source code.

CrabBot commented 12 years ago

Ironically, that's precisely what they're currently used for:

core => white node_modules in path => teal other (application code) => red

Raynos commented 12 years ago

@CrabBot the reason it's confusing is that my tool prints stderr in red so both core and other are red which is what's confusing me. I don't know which tool should stop using the color red >_<

CrabBot commented 12 years ago

That's a decent point. it would need a better alternative though. Currently it makes sense if you think about it. Red stands out the most and is the color you care most about. These stack traces are error stack traces, so red is applicable. White is used for core since it's a neutral color implying nothing, and teal for node_modules b/c it's easily ignored and is often the code you care the least about.

Raynos commented 12 years ago

@CrabBot I think the force node core to be white with the else statement is a good tradeoff.

Raynos commented 12 years ago

@CrabBot what do you think about adding a matcher for /test/ and /tests/ so that I can distinguish test statements and source code code statements

CrabBot commented 12 years ago

Perhaps making this configurable would be the best route by providing a regex and a color. We have a process running ongoing tests called "test", which would effectively color all its "red" to "?"

CrabDude commented 11 years ago

Will the new configure format work for this?

trycatch.configure({
  format: function(line) {
    // Alter the final output
    // return falsy value to remove
    return line
  }
})
CrabDude commented 11 years ago

Closing, feel free to reopen and/or submit a PR if this doesn't address your need.