tencent cloud

Tencent Cloud Super App as a Service

SDK Runtime Log Output

PDF
Focus Mode
Font Size
Last updated: 2025-07-04 17:33:30

Customize log output

By implementing the LogProxy in a mini program, developers can customize the way internal logs from the mini program SDK are handled and outputted.
Example:
@ProxyService(proxy = LogProxy.class)
public class LogProxyImpl extends LogProxy {

@Override
public void log(int logLevel, String tag, String msg, Throwable t) {
switch (logLevel) {
case Log.DEBUG:
if (t == null) {
android.util.Log.d(tag, msg);
} else {
android.util.Log.d(tag, msg, t);
}
break;
case Log.INFO:
if (t == null) {
android.util.Log.i(tag, msg);
} else {
android.util.Log.i(tag, msg, t);
}
break;
case Log.WARN:
if (t == null) {
android.util.Log.w(tag, msg);
} else {
android.util.Log.w(tag, msg, t);
}
break;
case Log.ERROR:
if (t == null) {
android.util.Log.e(tag, msg);
} else {
android.util.Log.e(tag, msg, t);
}
break;
default:
if (t == null) {
android.util.Log.v(tag, msg);
} else {
android.util.Log.v(tag, msg, t);
}
break;
}
}

@Override
public boolean isColorLevel() {
return true;
}
}



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback