view contrib/assimilate_alien_loggers.rb @ 9759:a83029cc7e6a 3.2.x

Do not require identical values when searching for a main value E.g. a value obtained using WQ.getRawValue() is not necessarily numerically identical, but nevertheless to be considered equal, to a matching Q main value. Fixes wrong descriptions in the result of a water level calculation, where not finding a matching main value led to the value being used as description instead of the name of the matching main value.
author Tom Gottfried <tom@intevation.de>
date Thu, 10 Nov 2022 15:39:07 +0100
parents 8dd89da79eaa
children
line wrap: on
line source
# run like ruby -i -p assimilate_alien_loggers.rb FILES(or stdin)
# This will replace in-place and will result in wrong getLogger
# statements in certain inner-class scenarios! Be careful.

$last_class
if $_ =~ /class ([a-zA-Z0-9]+)/
  $last_class = "#{$1}.class"
end
if $_ =~ /getLogger/
  gsub(/getLogger[ ]*\(.*\)/, "getLogger(#{$last_class})")
end

http://dive4elements.wald.intevation.org