Can you add the same function as "Recorded Console" to any kind of OutputStream?
Background: I'm writing code generators and the ability to seek to the piece of code which wrote some output to a file would be invaluable.
I don't think Post Execution Logging would fit my use case because there is no counter or offset "variable" in the standard OutputStream interface.
Allow to seek in time by position in any OutputStream created by the code
-
hmm interesting....
I think a better and more generic way to implement this inside Chronon would be to allow listing arguments to a particular method call, on a particular object.
In your case, you would:
- select the outputstream object you want to track
- select the methods whose arguments you want to list ( write() in your case)
- once selected, you would see exactly what was passed to write() everywhere in your code, and clicking on a line of output would take you to the correct point in time
Critics, improvements and all suggestions on this are welcome :) -
So a better solution would be to wrap the "OutputStream API" and collect all the data that passed through it. Only method calls from outside should be considered, no internal calls (for example, write(byte[]) calls write(byte[],int,int) which then calls write(int)).
The data should be presented in a text editor (so I can search the output) with a hex mode (for binary data).
Sorry if i wasnt too clear about this.
1. Yes the resulting output would be in a text editor window so you can easily copy it outside. In fact this functionality would be an extension to our existing 'Post Execution Logging' functionality, which already displays result in the text editor.
2. As for the internal calls to the write() method made by OutputStream api, well they wont be displayed, because we wont record them anyway, since they are inside outputstream and we wont record OutputStream internals because it resides in the java.** namespace which we dont record.
Thus you will see data of only the calls to the write() method made by your code and inside a text editor. Also since it will be part of post execution logging, you can change how the text is output, eg you can add the state of a different expression along with every line that is output, eg-
" $(this.filename} is writing "
and this will be displayed in a text editor for you to copy to a different editor outside eclipse and manipulate/search through the output.
How does this sound? :)
What I want is to click in the text editor and get to the point in time when the selected output was written.
Then I can search this view for the output that I'm interested in. When I have found something, I click and Chronon should show the stack trace at the time when this output was written.
So internally, you probably need to collect all the calls to write() and count bytes. But from the UI, it should look as if Chronon would just display the content of a file.
The reason why I ask for a support for this is that it's pretty hard to locate the OutputStream when you have a file name. For Chronon, it would be easy to find the file object, then the FileOutputStream and from that, it would know which OutputStream was used to write to the file (or rather which streams since output streams are usually wrapped in Java).