File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 66# Alternative command if the above does not work
77# system "tail -n 10000 log/#{Rails.env}.log | tac | sed \"/APPCLEANED/ q\" | sed 'x;1!H;$!d;x' > 'log/#{filename}.log'"
88
9- # create a json debug file for server debugging
10- json_result = { }
11- json_result [ 'error' ] = command_options . fetch ( 'error_message' , 'no error message' )
9+ # create a yaml debug file for server debugging
10+ result = { }
11+ result [ 'error' ] = command_options . fetch ( 'error_message' , 'no error message' )
1212
1313if defined? ( ActiveRecord ::Base )
14- json_result [ 'records' ] =
14+ result [ 'records' ] =
1515 ActiveRecord ::Base . descendants . each_with_object ( { } ) do |record_class , records |
1616 begin
1717 records [ record_class . to_s ] = record_class . limit ( 100 ) . map ( &:attributes )
2121end
2222
2323filename = command_options . fetch ( 'runnable_full_title' , 'no title' ) . gsub ( /[^[:print:]]/ , '' )
24- File . open ( "#{ Rails . root } /log/#{ filename } .json" , "w+" ) do |file |
25- file << JSON . pretty_generate ( json_result )
24+ yml_filename = Rails . root . join ( "log" , "#{ filename } .yml" )
25+ File . open ( yml_filename , "w+" ) do |file |
26+ file . write ( Psych . dump ( result ) )
2627end
28+ $sterr. puts ( "!!! Wrote #{ yml_filename } " )
You can’t perform that action at this time.
0 commit comments