Skip to content

Commit

Permalink
added status to log output (done/fail)
Browse files Browse the repository at this point in the history
version bump to 0.1.2
  • Loading branch information
iMacTia committed Jul 5, 2016
1 parent 8408658 commit ce66319
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Sidekiq::Logstash turns your [Sidekiq](https://github.com/mperham/sidekiq) log i
"args" : ["first_param","second_param"],
"retry" : true,
"queue" : "default",
"status" : "fail",
"jid" : "fd71783c0afa3f5e0958f3e9",
"created_at" : "2016-07-02T14:03:26.423Z",
"enqueued_at" : "2016-07-02T14:03:26.425Z",
Expand Down
2 changes: 1 addition & 1 deletion lib/sidekiq/logstash/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Sidekiq
module Logstash
VERSION = '0.1.1'
VERSION = '0.1.2'
end
end
2 changes: 2 additions & 0 deletions lib/sidekiq/middleware/server/logstag_logging.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ def log_job(payload, exc = nil)
payload.merge!(@custom_options.call(payload, exc)) if @custom_options rescue nil

if exc
payload['status'] = 'fail'
payload['error_message'] = exc.message
payload['error']
payload['error_backtrace'] = %('#{exc.backtrace.join("\n")}')
Sidekiq.logger.warn payload
else
payload['status'] = 'done'
payload['completed_at'] = Time.now.utc
Sidekiq.logger.info payload
end
Expand Down

0 comments on commit ce66319

Please sign in to comment.