mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-15 18:44:47 +01:00
add logging
This commit is contained in:
parent
c2b8505634
commit
e37caf06b1
@ -25,6 +25,12 @@ import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
import java.util.logging.Formatter;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.logging.StreamHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@ -73,6 +79,26 @@ public class JWebAssembly {
|
||||
*/
|
||||
public static final String REPLACE_ANNOTATION = "de.inetsoftware.jwebassembly.api.annotation.Replace";
|
||||
|
||||
/**
|
||||
* The logger instance
|
||||
*/
|
||||
public static final Logger LOGGER = Logger.getAnonymousLogger( null );
|
||||
static {
|
||||
LOGGER.setUseParentHandlers( false );
|
||||
ConsoleHandler handler = new ConsoleHandler() {{
|
||||
setOutputStream(System.out);
|
||||
}};
|
||||
handler.setFormatter( new Formatter() {
|
||||
@Override
|
||||
public String format( LogRecord record ) {
|
||||
return record.getMessage() + '\n';
|
||||
}
|
||||
});
|
||||
handler.setLevel( Level.ALL );
|
||||
LOGGER.addHandler( handler );
|
||||
//LOGGER.setLevel( Level.FINE );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a instance.
|
||||
*/
|
||||
|
@ -162,14 +162,17 @@ public class ModuleGenerator {
|
||||
ClassFile classFile = ClassFile.get( next.className, libraries );
|
||||
if( classFile == null ) {
|
||||
if( next instanceof SyntheticFunctionName ) {
|
||||
JWebAssembly.LOGGER.info( '\t' + next.methodName + next.signature );
|
||||
scanMethod( ((SyntheticFunctionName)next).getCodeBuilder( watParser ) );
|
||||
functions.markAsScanned( next );
|
||||
}
|
||||
} else {
|
||||
JWebAssembly.LOGGER.fine( "scan class: " + next.className );
|
||||
iterateMethods( classFile, method -> {
|
||||
try {
|
||||
FunctionName name = new FunctionName( method );
|
||||
if( functions.needToScan( name ) ) {
|
||||
JWebAssembly.LOGGER.fine( '\t' + name.methodName + name.signature );
|
||||
scanMethod( createInstructions( functions.replace( name, method ) ) );
|
||||
functions.markAsScanned( name );
|
||||
}
|
||||
@ -226,6 +229,7 @@ public class ModuleGenerator {
|
||||
writeMethodSignature( name, functions.isStatic( name ), null );
|
||||
}
|
||||
|
||||
JWebAssembly.LOGGER.fine( "scan finsih" );
|
||||
types.prepareFinish( writer, functions, libraries );
|
||||
prepareFunctions(); // prepare of types can add some override methods as needed
|
||||
functions.prepareFinish();
|
||||
|
@ -30,6 +30,7 @@ import de.inetsoftware.classparser.ClassFile;
|
||||
import de.inetsoftware.classparser.ConstantClass;
|
||||
import de.inetsoftware.classparser.FieldInfo;
|
||||
import de.inetsoftware.classparser.MethodInfo;
|
||||
import de.inetsoftware.jwebassembly.JWebAssembly;
|
||||
import de.inetsoftware.jwebassembly.WasmException;
|
||||
import de.inetsoftware.jwebassembly.wasm.AnyType;
|
||||
import de.inetsoftware.jwebassembly.wasm.NamedStorageType;
|
||||
@ -101,6 +102,7 @@ public class TypeManager {
|
||||
public StructType valueOf( String name ) {
|
||||
StructType type = map.get( name );
|
||||
if( type == null ) {
|
||||
JWebAssembly.LOGGER.fine( "\t\ttype: " + name );
|
||||
type = new StructType( name );
|
||||
map.put( name, type );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user