diff options
author | Chris Tonkinson <chris@tonkinson.com> | 2015-06-17 13:23:11 -0400 |
---|---|---|
committer | Chris Tonkinson <chris@tonkinson.com> | 2015-06-23 14:01:28 -0400 |
commit | f5d8dd6d8fc13bf931896f8435baf9779b3136ab (patch) | |
tree | 326523d5c7060a8e2c6d19bdc14283deb43dc022 /actionview/lib | |
parent | 1022796ac075a5f1a3ca45f4d48284d4bfa2567a (diff) | |
download | rails-f5d8dd6d8fc13bf931896f8435baf9779b3136ab.tar.gz rails-f5d8dd6d8fc13bf931896f8435baf9779b3136ab.tar.bz2 rails-f5d8dd6d8fc13bf931896f8435baf9779b3136ab.zip |
More granular console SQL coloration
This new coloration approach makes it easier to scan the rails console
for specific types of activity with more fine-grained visual cues.
Virtual terminal ANSI color escape codes are used when displaying SQL
statements in the rails console. The former implementation alternates
line prefix information (including the statement name and execution
latency) between CYAN and MAGENTA. This visually differentiates any SQL
statements in the log and is useful for quickly scanning for database
activity.
While a great idea and a solid foundation, alternating between just two
colors on an even/odd basis (much like striping an HTML table) can be
improved upon.
This patch replaces the even/odd striping with a more comprehensive
scheme that applies coloration based on the type of statement being
run. Every statement logged has its prefix (name and latency) colored
white (as the statement body was previously). The statement body is now
colored according to the nature of the statement:
- INSERT statements are GREEN (symbolic of creation or genesis)
- SELECT statements are BLUE (typically used for informational
displays, as SELECT statements do not normally have side-effects)
- DELETE statements are RED (commonly used to indicate the danger of
a destructive action)
- UPDATE statements are YELLOW (it's like a less extreme RED :P)
- TRANSACTION statements are CYAN (arbitrary)
- and any other statements are MAGENTA (again, arbitrary)
Diffstat (limited to 'actionview/lib')
0 files changed, 0 insertions, 0 deletions