Whole bunch of changes
Run sync within a SQL transaction, so that no partial sync happens Don't abort on SQL errors, but print ERROR notice Exit with code 1 when any ERRORs were logged Silence the test suite, so that test runs are more clearly Use PG queries instead of psql in test. This is more flexible than parsing text outputs per Regexp.
This commit is contained in:
24
lib/pg_ldap_sync/logger.rb
Normal file
24
lib/pg_ldap_sync/logger.rb
Normal file
@ -0,0 +1,24 @@
|
||||
require 'logger'
|
||||
|
||||
module PgLdapSync
|
||||
class Logger < ::Logger
|
||||
def initialize(io, counters)
|
||||
super(io)
|
||||
@counters = {}
|
||||
end
|
||||
|
||||
def add(severity, *args)
|
||||
@counters[severity] ||= 0
|
||||
@counters[severity] += 1
|
||||
super
|
||||
end
|
||||
|
||||
def had_logged?(severity)
|
||||
@counters[severity] && @counters[severity] > 0
|
||||
end
|
||||
|
||||
def had_errors?
|
||||
had_logged?(Logger::FATAL) || had_logged?(Logger::ERROR)
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user