Closed asenchi closed 10 years ago
I need to find a method for generating a longer exception, both for examples above and tests. Anyone have ideas?
I need to find a method for generating a longer exception, both for examples above and tests.
Here's one option to consider: https://gist.github.com/jasonrudolph/584058a67b64d89e9957
There might be a better way to accomplish this, but that approach would probably work for testing purposes.
You mentioned that you're also hoping to generate long exceptions for use in examples. The approach above will probably not work for that purpose. It would produce some pretty boring examples. ;-)
Oh, nice, I'll work that up this afternoon.
Alright, fixed this up, need to work on tests yet:
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:11:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:12:in raise_error_with_at_least_n_backtrace_lines"
now="2014-01-23T19:31:08Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70181716367520 site="./test.rb:16:in <main>"
now="2014-01-23T19:31:02Z" app=scrolls deploy=nil at=exception class=RuntimeError message=Boom! exception_id=70171943639240 site="./test.rb:11:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:12:in raise_error_with_at_least_n_backtrace_lines\\n./test.rb:16:in <main>"
Alright, we've got tests. Going to ship a new version with this.
This adds a new feature for managing exception data in generated log messages. Default behavior is to generate a log message for each line of the backtrace, the result of which could be many lines for a single exception. To cut down on duplication and data transport this generates a single log message for the exception, joining all backtrace lines by
'\n'
.Before
After