Log Management
1 Initialize Log
Initialize the host log. Provide the function to print log levels and proxy host log printing.
1.1 Interface Prototype
void initLog(int logLevel)
void initLog(int logLevel, LogPrinter logPrinter)
1.2 Parameter Description
| parameter | Data Type | Required | Attribute Description |
|---|---|---|---|
| logLevel | int | Yes | 日志优先级 <li>LogLevel.VERBOSE: 2 </li><li>LogLevel.DEBUG: 3 </li><li>LogLevel.INFO: 4 </li><li>LogLevel.WARN: 5 </li><li>LogLevel.ERROR: 6 </li><li>LogLevel.ASSERT: 7 </li><li>LogLevel.ALL: Integer.MIN_VALUE </li><li>LogLevel.SILENT: Integer.MAX_VALUE |
| logPrinter | com.u3d.webglhost.log.LogPrinter | No | Used for log printing, see the log printing interface for details |
1.3 Code Example
hostHandle.initLog(LogLevel.ALL, new SampleLogPrinter());
// SampleLogPrinter.java
import com.u3d.webglhost.log.LogPrinter;
public class SampleLogPrinter implements LogPrinter {
@Override
public void println(int level, String tag, String msg) {
if (msg != null) {
msg = "[Host_Sample]" + msg;
}
Log.println(level, tag, msg);
}
}