tencent cloud

Feedback

Logging and Event Reporting

Last updated: 2024-11-21 17:33:43

    Custom log output implementation

    By implementing the LogProxy API, you can control the internal logging of the mini program SDK.
    Sample code:
    @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; }
    }

    Custom Event Reporting

    The host APP can override the internal reporting logic of TCMPP SDK by implementing the reportMiniAppEvent method of MiniAppProxy to customize the mini program event reporting.
    Note:
    Includes mini program operation events and the data reported by calling wx.reportEvent inside the mini program.
    API is as follows:
    /**
    * Agent for reporting mini program events.
    * @param eId eventId
    * @param eventName event name
    * @param props event property
    * @param app Mini program information.
    * @return is true, the SDK internal reporting logic is no longer executed, and the user-defined event reporting logic is used.
    */ public abstract boolean reportMiniAppEvent(int eId, String eventName, JSONObject props, MiniApp app);
    The built-in event IDs are described below:
    /** Custom event */
    public static final int EID_None = 0;
    
    /** Open a mini program */.
    public static final int EID_OPEN_MINIAPP = 1;
    
    /** Update mini program */ public static final int EID_OPEN_MINIAPP = 1.
    public static final int EID_UPDATE_MINIAPP = 2;
    
    /** Download mini program */
    public static final int EID_DOWNLOAD_MINIAPP = 3;
    
    /** Mini-program page view */
    public static final int EID_MINIAPP_PAGE_VIEW = 4;
    
    /** Exit mini program */ public static final int EID_MINIAPP_PAGE_VIEW = 4.
    public static final int EID_EXIT_MINIAPP = 5;
    
    /** Behavioural event of mini program */
    public static final int EID_MINIAPP_ACTION = 6;

    Customised Log Reporting

    Real Time Log Reporting

    The host APP can customize the mini program real-time event log reporting logic by implementing the reportRealTimeLog method of MiniAppProxy.
    Note:
    Include the log data written by the mini program internal call wx.getRealtimeLogManager.
    API is as follows:
    /**
    * Mini program real-time log upload agent
    * @param page Current page
    * @param jsLibVersion base library version
    * @param app mini program information
    * @param filterMsgs filter keywords
    * @param logs logs
    * @return is true, the SDK internal reporting logic is no longer executed.
    */ public abstract boolean reportRealTimeLog(String page, String jsLibVersion, MiniApp app, String[] filterMsgs, ArrayList<RealTimeLogItem> logs);

    Internal log reporting for mini programs

    The host APP can customise the complaint feedback page of the mini program to collect the log upload logic by implementing the uploadUserLog method of MiniAppProxy.
    Note:
    This includes log data written by the mini program's internal call to wx.getLogManager, and the user can upload printed logs by using the button component's open-type="feedback".
    /**
    * feedback log upload
    *
    * @param appId mini program appId
    * @param logPath The log path.
    * @return is true, the SDK internal upload logic is not executed.
    */ public abstract boolean uploadUserLog(String appId, String logPath);
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support