diff options
author | Azul <azul@riseup.net> | 2013-11-23 10:35:40 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2013-11-23 10:35:40 +0100 |
commit | 4c7bc8b661250bb7fe1000ae1515507c5bf4beb1 (patch) | |
tree | ec57036631a5aeee439eae529ccf3631d2dbcb49 | |
parent | fd648d3fe7c4573974ce1e554256896057dcd8f2 (diff) |
more verbose error logging - also print the doc we tried
-rw-r--r-- | files/couch-doc-update | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/files/couch-doc-update b/files/couch-doc-update index 625847f..9101802 100644 --- a/files/couch-doc-update +++ b/files/couch-doc-update @@ -38,11 +38,17 @@ def main exit 0 if result['ok'] raise StandardError.new(result.inspect) rescue StandardError => exc - $stderr.puts "ERROR: " + exc.to_s + db_without_password = db.to_s.sub(/:[^\/]*@/, ':PASSWORD_HIDDEN@') + log "ERROR: " + exc.to_s + log " failed writing to #{db_without_password}/#{id}" + exit 1 +end + +def log(message) + $stderr.puts message Syslog.open do |logger| - logger.log(Syslog::LOG_CRIT, exc.to_s) + logger.log(Syslog::LOG_CRIT, message) end - exit 1 end def process_options |