lib/evrone/ci/worker/job.rb in evrone-ci-worker-0.2.0.pre1 vs lib/evrone/ci/worker/job.rb in evrone-ci-worker-0.2.0.pre3
- old
+ new
@@ -6,15 +6,16 @@
module Worker
class Job
include Helper::Logger
- attr_reader :output, :message
+ attr_reader :output, :message, :output_counter
def initialize(perform_job_message)
- @output = ""
- @message = perform_job_message
+ @output_counter = 0
+ @output = ""
+ @message = perform_job_message
end
def add_to_output(str)
output << str
logger.debug str.strip if logger.level == 0
@@ -23,16 +24,19 @@
def add_command_to_output(cmd)
add_to_output "$ #{cmd}\n"
end
+ def add_trace_to_output(log)
+ add_to_output log.split(/\n/).map{|i| " ===> #{i}\n" }.join
+ end
+
def create_job_log_message(data)
- tm = Time.now
+ @output_counter += 1
Message::JobLog.new(
build_id: message.id,
job_id: message.job_id,
- tm: tm.to_i,
- tm_usec: tm.usec,
+ tm: @output_counter,
log: data
)
end
end