44import io .github .freehij .loader .annotation .EditClass ;
55import io .github .freehij .loader .annotation .Local ;
66import io .github .freehij .loader .constant .At ;
7- import io .github .freehij .loader .util .Logger ;
87import org .objectweb .asm .*;
8+ import org .slf4j .Logger ;
9+ import org .slf4j .LoggerFactory ;
910
1011import java .io .*;
1112import java .lang .instrument .ClassFileTransformer ;
2425
2526public class Loader {
2627 static final String VERSION = "a1.0.0" ;
28+ static final Logger LOGGER = LoggerFactory .getLogger ("Loader" );
2729 static final Map <String , List <InjectionPoint >> injectionPoints = new HashMap <>();
2830 static final List <ModInfo > mods = new ArrayList <>();
2931 static final List <URL > modUrls = new ArrayList <>();
@@ -61,9 +63,9 @@ static void defineMods(boolean log) {
6163 ));
6264 loadMods ();
6365 if (log ) {
64- Logger .info ("Found mods:" , "Loader " );
66+ LOGGER .info ("Found mods:" );
6567 for (ModInfo mod : mods ) {
66- Logger .info (" - " + mod .toString (), "Loader" );
68+ LOGGER .info (" - {}" , mod .toString ());
6769 }
6870 }
6971 }
@@ -166,7 +168,7 @@ static class MixinTransformer implements ClassFileTransformer {
166168 public byte [] transform (ClassLoader l , String className , Class <?> c ,
167169 ProtectionDomain d , byte [] buffer ) {
168170 if (!injectionPoints .containsKey (className )) return null ;
169- Logger . debug ("Loading " + className + " , loader: " + l .getName (), this );
171+ LOGGER . info ("Loading {} , loader: {}" , className , l .getName ());
170172 ClassReader cr = new ClassReader (buffer );
171173 ClassWriter cw = new ClassWriter (cr , ClassWriter .COMPUTE_FRAMES | ClassWriter .COMPUTE_MAXS );
172174 cr .accept (new InjectionClassVisitor (cw , className ), 0 );
@@ -191,8 +193,7 @@ public MethodVisitor visitMethod(int access, String name, String desc,
191193 for (InjectionPoint point : points ) {
192194 if (point .inject .method ().equals (name ) &&
193195 (point .inject .descriptor ().isEmpty () || point .inject .descriptor ().equals (desc ))) {
194- Logger .debug ("Transforming " + name + desc +
195- ", handler: " + point .handlerClass + "." + point .handlerMethod , this );
196+ LOGGER .info ("transforming {}" , name + desc );
196197 mv = new InjectionMethodVisitor (mv , access , desc , point , this .className );
197198 }
198199 }
@@ -262,8 +263,7 @@ void injectHelper() {
262263 }
263264 }
264265
265- static void generateHelperCall (MethodVisitor mv , int access , String desc , InjectionPoint injection ,
266- String className ) {
266+ static void generateHelperCall (MethodVisitor mv , int access , String desc , InjectionPoint injection , String className ) {
267267 boolean isStatic = (access & Opcodes .ACC_STATIC ) != 0 ;
268268
269269 mv .visitTypeInsn (Opcodes .NEW , "io/github/freehij/loader/util/InjectionHelper" );
0 commit comments