SDK runtime log printing
Implement the log output API during the development phase to facilitate troubleshooting.
Note:
It is recommended to disable log output when the app is released to ensure security and performance.
- (void)log:(MALogLevel)level msg:(NSString *)msg;
Reporting the event
The host app can implement the event reporting API to override the internal reporting logic of the TCMPP SDK.
This includes mini program operation events and data reported by the mini program's internal wx.reportEvent.
typedef NS_ENUM(NSInteger,TMAReportEventID){.
TMAReportEventID_None = 0,
TMAReportEventID_OPEN_MINIAPP = 1,
TMAReportEventID_UPDATE_MINIAPP = 2,
TMAReportEventID_DOWNLOAD_MINIAPP = 3,
TMAReportEventID_MINIAPP_PAGE_VIEW = 4,
TMAReportEventID_EXIT_MINIAPP = 5,
TMAReportEventID_MINIAPP_ACTION = 6
};
- (BOOL)reportEvent:(int)eventId
eventName:(NSString *)eventName
params:(NSDictionary *)params
appinfo:(TMFMiniAppInfo *)appInfo;
Real-time log reporting for mini programs
The host app can implement an event realtime log reporting interface to override the reporting logic inside the TCMPP SDK.
Including the log data written by calling wx.getRealtimeLogManager inside the mini program.
- (BOOL)reportRealTimeLogWithAppId:(NSString *)appId
jsVersion:(NSString *)jsVersion
page:(NSString *)page
filterMsgs:(NSArray <NSString *>*)filterMsgs
logs:(NSArray <TMARealtimeLogItem *>*)logs
completionBlock:(void (^)(NSError * _Nullable error))completionBlock;
Internal log reporting for mini programs
The host app can implement event real-time log reporting interface to override the reporting logic inside TCMPP SDK.
Including the log data written by wx.getLogManager within the mini program, and the user can upload the printed log by using the open-type="feedback" of the button component.// Upload the logs of the mini program corresponding to the appID - Upload the logs of the mini program corresponding to the appID
- (void)uploadLogFileWithAppID:(NSString *)appID;
Was this page helpful?