From 641a04fc2dd876440ed983a4cdf0e03f188040c1 Mon Sep 17 00:00:00 2001 From: Tim Pierce Date: Mon, 29 Sep 2014 14:01:00 -0400 Subject: [PATCH] 3782: print log lines compatible with the log viewer When the log is truncated, make it parsable by the log viewer regex in addToLogViewer(). --- apps/workbench/app/controllers/collections_controller.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/workbench/app/controllers/collections_controller.rb b/apps/workbench/app/controllers/collections_controller.rb index fb9d337762..bdfa8326db 100644 --- a/apps/workbench/app/controllers/collections_controller.rb +++ b/apps/workbench/app/controllers/collections_controller.rb @@ -308,8 +308,13 @@ class CollectionsController < ApplicationController end yield buf end - if @opts.include? :size and bytesleft == 0 then - yield "Log truncated (exceeded #{@opts[:size]} bytes). To retrieve the full log: arv-get #{@opts[:uuid]}/#{@opts[:file]}" + if buf and @opts.include? :size and bytesleft == 0 then + unless buf[-1] == "\n" + yield "\n" + end + # This line should match the regex in + # app/assets/javascripts/log_viewer.js:addToLogViewer() + yield Time.now.strftime("%F_%T zzzzz-zzzzz-zzzzzzzzzzzzzzz 0 File truncated (exceeded #{@opts[:size]} bytes). To retrieve the full file: arv-get #{@opts[:uuid]}/#{@opts[:file]}\n") end end Rails.logger.warn("#{@opts[:uuid]}/#{@opts[:file]}: #{$?}") if $? != 0 -- 2.39.5