astashov / vim-ruby-debugger

Vim plugin for debugging Ruby applications (using ruby-debug-ide gem)
435 stars 36 forks source link

efficient logging #55

Closed stephenprater closed 13 years ago

stephenprater commented 13 years ago

fix the logging problem in issue #44

astashov commented 13 years ago

Thanks for the pull request, and it is a cool idea, but these spaces at the front of every line - I wasn't be able to remove them. Could you please try to fix that? I don't think it is a good idea to use logging with these spaces, sorry.

stephenprater commented 13 years ago

That should do it.

astashov commented 13 years ago

It almost works, but sometimes it concatenated lines together (occasionly, I don't know why :( ) Like:

Vim plugin, 11:48:14: Trying to find listener of port 39767
Vim plugin, 11:48:14: Executing command: lsof -i tcp:39767 | grep LISTEN | awk '{print $2}'Ruby_debugger.rb, 11:48:14: Starting to connect by TCPSocket with host: 127.0.0.1 and port: 39767

Damn. :( Maybe try to use inline Ruby in the s:Logger class? The overhead should not be significant.

stephenprater commented 13 years ago

This happens when the ruby_debugger.rb appends to the log file. Vim doesn't want to leave a newline at the end of the file, so it starts each echoed line with a new line. Using IO#puts in ruby does the opposite, appending a newline to the string.

This should fix it so the lines are always separated. Also - the messages the debugger sends back and forth sometimes include a newline (example - "start\n") - so we have to chomp the logged string to prevent the occasional blank line in ruby_debugger.rb's logging output.

astashov commented 13 years ago

This is AWESOME! It works perfectly! Thanks a lot!