File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -168,7 +168,8 @@ def have_unclosed_tag?(output)
168168 def log ( string )
169169 if @params [ :debug_mode ] == '1'
170170 File . open ( @params [ :logger_file ] , 'a' ) do |f |
171- f . puts 'Ruby_debugger.rb, ' + Time . now . strftime ( "%H:%M:%S" ) + ': ' + string
171+ # match vim redir style new lines, rather than trailing
172+ f << "\n Ruby_debugger.rb, #{ Time . now . strftime ( "%H:%M:%S" ) } : #{ string . chomp } "
172173 end
173174 end
174175 end
Original file line number Diff line number Diff line change @@ -11,19 +11,20 @@ endfunction
1111
1212
1313" Log datetime and then message. It logs only if debug mode is enabled
14- " TODO: Now to add one line to the log file, it read whole file to memory, add
15- " one line and write all that stuff back to file. When log file is large, it
16- " affects performance very much. Need to find way to write only to the end of
17- " file (preferably - crossplatform way. Maybe Ruby?)
18- function ! s: Logger .put (string )
14+ " TODO It outputs a bunch of spaces at the front of the entry - fix that.
15+ function ! s: Logger .put (string ) dict
1916 if g: ruby_debugger_debug_mode
20- let file = readfile (self .file )
2117 let string = ' Vim plugin, ' . strftime (" %H:%M:%S" ) . ' : ' . a: string
22- call add (file , string )
23- call writefile (file , self .file )
18+ exec ' redir >> ' . g: RubyDebugger .logger.file
19+ silent call s: Logger .silent_echo (s: strip (string ))
20+ exec ' redir END'
2421 endif
2522endfunction
2623
27- " *** Logger class (end)
28-
24+ function ! s: Logger .silent_echo (string )
25+ echo a: string
26+ endfunction
2927
28+ " *** Logger class (end)
29+ "
30+ "
You can’t perform that action at this time.
0 commit comments