Module: Kiss::Debug
- Defined in:
- lib/kiss/debug.rb
Overview
Generates HTML reports on exceptions raised from the app, showing the backtrace with clickable stack frames with TextMate links to source files, plus login hash, last SQL, GET/POST params, cookies, and Rack environment variables.
Instance Method Summary collapse
Instance Method Details
#prepend_debug(document) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/kiss/debug.rb', line 7 def prepend_debug(document) html = "<style>\n.kiss_debug {\ntext-align: left;\npadding: 3px 7px;\nborder: 1px solid #ebe;\nborder-top: 1px solid #fdf;\nborder-bottom: 1px solid #d6d;\nbackground-color: #fbf;\nfont-size: 12px;\ncolor: #101;\n}\n.kiss_debug a {\ncolor: #606;\ntext-decoration: none;\n}\n.kiss_debug a:hover {\ncolor: #707;\ntext-decoration: underline;\n}\n.kiss_debug small {\n font-family: arial, sans-serif;\n color: #949;\n float: right;\n margin-left: 8px;\n text-align: right;\n white-space: nowrap;\n}\n</style>\n" html += .map do |object, context| filename, line, method = context.split(/:/) textmate_url = "txmt://open?url=file://" + Kiss.absolute_path(filename).url_escape + '&line=' + line "<div class=\"kiss_debug\">\n<small>kiss debug at <a href=\"\#{textmate_url}\">\#{filename}:\#{line}</a> \#{method}</small>\n<tt><b>\#{object.gsub(/\\</, '<')}</b></tt>\n</div>\n" end.join document.prepend_html(html, 'body') end |