[PATCH 2 of 3] Added spooky ruby script to get started fixing logger instances of wrong classes

Wald Commits scm-commit at wald.intevation.org
Fri Nov 8 10:39:57 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1383902552 -3600
# Node ID 8dd89da79eaa8dfbef3a927d5fa9cfc174b8f312
# Parent  06ebfc33578da18df7aa1ca08d07db60e589e09f
Added spooky ruby script to get started fixing logger instances of wrong classes.

diff -r 06ebfc33578d -r 8dd89da79eaa contrib/assimilate_alien_loggers.rb
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/assimilate_alien_loggers.rb	Fri Nov 08 10:22:32 2013 +0100
@@ -0,0 +1,11 @@
+# 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


More information about the Dive4elements-commits mailing list