Bright black "hides" some bunyan CLI styled text when using Solarized Dark theme

fixes #160
This commit is contained in:
Trent Mick 2014-08-10 00:36:55 -07:00
parent dacdd080dc
commit 26a8bb02a4
4 changed files with 20 additions and 8 deletions

View file

@ -8,7 +8,9 @@ Known issues:
## bunyan 1.0.1 (not yet released) ## bunyan 1.0.1 (not yet released)
(nothing yet) - [issue #160] Stop using ANSI 'grey' in `bunyan` CLI output, because of the
problems that causes with Solarized Dark themes (see
<https://github.com/altercation/solarized/issues/220>).
## bunyan 1.0.0 ## bunyan 1.0.0

View file

@ -59,7 +59,7 @@ facilities in node 0.12 to which bunyan can switch.
- [`bunyan` CLI](#cli-usage) for pretty-printing and filtering of Bunyan logs - [`bunyan` CLI](#cli-usage) for pretty-printing and filtering of Bunyan logs
- simple include of log call source location (file, line, function) with - simple include of log call source location (file, line, function) with
[`src: true`](#src) [`src: true`](#src)
- light-weight specialization of Logger instances with [`log.child`](#logchild) - lightweight specialization of Logger instances with [`log.child`](#logchild)
- custom rendering of logged objects with ["serializers"](#serializers) - custom rendering of logged objects with ["serializers"](#serializers)
- [Runtime log snooping via DTrace support](#dtrace-support) - [Runtime log snooping via DTrace support](#dtrace-support)

View file

@ -590,8 +590,10 @@ function isInteger(s) {
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
// Suggested colors (some are unreadable in common cases): // Suggested colors (some are unreadable in common cases):
// - Good: cyan, yellow (limited use), grey, bold, green, magenta, red // - Good: cyan, yellow (limited use), bold, green, magenta, red
// - Bad: blue (not visible on cmd.exe) // - Bad: blue (not visible on cmd.exe), grey (same color as background on
// Solarized Dark theme from <https://github.com/altercation/solarized>, see
// issue #160)
var colors = { var colors = {
'bold' : [1, 22], 'bold' : [1, 22],
'italic' : [3, 23], 'italic' : [3, 23],
@ -746,8 +748,8 @@ function emitRecord(rec, line, opts, stylize) {
var level = (upperPaddedNameFromLevel[rec.level] || 'LVL' + rec.level); var level = (upperPaddedNameFromLevel[rec.level] || 'LVL' + rec.level);
if (opts.color) { if (opts.color) {
var colorFromLevel = { var colorFromLevel = {
10: 'grey', // TRACE 10: 'white', // TRACE
20: 'grey', // DEBUG 20: 'yellow', // DEBUG
30: 'cyan', // INFO 30: 'cyan', // INFO
40: 'magenta', // WARN 40: 'magenta', // WARN
50: 'red', // ERROR 50: 'red', // ERROR
@ -958,9 +960,9 @@ function emitRecord(rec, line, opts, stylize) {
} }
extras = stylize( extras = stylize(
(extras.length ? ' (' + extras.join(', ') + ')' : ''), 'grey'); (extras.length ? ' (' + extras.join(', ') + ')' : ''), 'XXX');
details = stylize( details = stylize(
(details.length ? details.join('\n --\n') + '\n' : ''), 'grey'); (details.length ? details.join('\n --\n') + '\n' : ''), 'XXX');
if (!short) if (!short)
emit(format('%s %s: %s on %s%s:%s%s\n%s', emit(format('%s %s: %s on %s%s:%s%s\n%s',
time, time,

8
tools/colors.log Normal file
View file

@ -0,0 +1,8 @@
# A log file to use to show bunyan colors
{"name":"colors","hostname":"grape.local","pid":52694,"level":10,"msg":"this is the msg","time":"2014-08-10T07:02:40.552Z","src":{"file":"/Users/trentm/tm/node-bunyan/examples/src.js","line":8},"v":0}
{"name":"colors","hostname":"grape.local","pid":52694,"level":20,"msg":"this is the msg","time":"2014-08-10T07:02:40.550Z","v":0}
{"name":"colors","hostname":"grape.local","pid":52694,"level":30,"msg":"this is the msg","time":"2014-08-10T07:02:40.551Z","v":0}
{"name":"colors","hostname":"grape.local","pid":52694,"level":40,"msg":"this is the msg","time":"2014-08-10T07:02:40.551Z","v":0}
{"name":"colors","hostname":"grape.local","pid":52694,"level":50,"msg":"this is the msg","time":"2014-08-10T07:02:40.551Z","v":0}
{"name":"colors","hostname":"grape.local","pid":52694,"agent":"a6359483-80b7-4a71-bb12-84cab83816b3","level":30,"req_id":"baf281a7-e4f3-4e6c-80d3-8154b5b220d0","req":{"method":"HEAD","url":"/agentprobes","headers":{"accept":"application/json","content-type":"application/json","host":"localhost","connection":"close"},"httpVersion":"1.1","trailers":{},"version":"*"},"res":{"statusCode":200,"headers":{"content-md5":"11FxOYiYfpMxmANj4kGJzg==","access-control-allow-origin":"*","access-control-allow-headers":"Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version","access-control-allow-methods":"HEAD","access-control-expose-headers":"X-Api-Version, X-Request-Id, X-Response-Time","connection":"close","date":"Fri, 14 Dec 2012 01:11:04 GMT","server":"Amon Relay/1.0.0","x-request-id":"baf281a7-e4f3-4e6c-80d3-8154b5b220d0","x-response-time":0},"trailer":false},"route":{"name":"HeadAgentProbes","version":false},"latency":0,"secure":false,"_audit":true,"msg":"HeadAgentProbes handled: 200","time":"2012-12-14T01:11:04.218Z","v":0}
{"name":"colors","hostname":"grape.local","pid":52694,"level":60,"msg":"this is the msg","time":"2014-08-10T07:02:40.551Z","v":0}