tencent cloud

All product documents
Tencent Cloud Super App as a Service
Logging and Event Reporting
Last updated: 2025-03-17 15:45:40
Logging and Event Reporting
Last updated: 2025-03-17 15:45:40

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.
/// Print log
/// @param level Log level. For more information, see `PLTLogLevel`.
/// @param msg Log message
- (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 SDK.
This includes mini program operation events and data reported by the mini program's internal wx.reportEvent.
typedef NS_ENUM(NSInteger,TMAReportEventID){.
// undefined, report user-defined events
// undefined, report user-defined event
TMAReportEventID_None = 0,
// Open the mini program.
// Open the mini program.
TMAReportEventID_OPEN_MINIAPP = 1,
// update the mini program
// Update the mini program.
TMAReportEventID_UPDATE_MINIAPP = 2,
// Download the mini program.
// Download the mini program.
TMAReportEventID_DOWNLOAD_MINIAPP = 3,
// Open the mini program page.
// Open the mini program page.
TMAReportEventID_MINIAPP_PAGE_VIEW = 4,
// Exit the mini program.
// close the mini program
TMAReportEventID_EXIT_MINIAPP = 5,
// mini program behaviour event, atcion:0 background; 1 foreground
// mini program behaviour event, atcion: 0 onHide; 1 onShow
TMAReportEventID_MINIAPP_ACTION = 6
};

// Upload data - report data
// @param event event, refer to TMAReportEventID - event ID, refer to TMAReportEventID
// @param eventName eventName - the name of the event
// @param params params - Parameters
// @param appInfo appletInfo - information about the mini program
// @return Whether to intercept internal reporting - Whether to intercept internal reporting
- (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 SDK.
Including the log data written by calling wx.getRealtimeLogManager inside the mini program.
// Report log data - Report log data
// @param appId appID
// @param jsVersion base library version - base library version
// @param page current page - Current page
// @param filterMsgs Filtered Content - Filtered Content
// @param logs log events - log events
// @param completionBlock - The result of the callback.
// @return Whether to block internal reporting - Whether to block internal reporting
- (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 the 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
// Upload the logs of the mini program corresponding to the appID - Upload the logs of the mini program corresponding to the appID
// Implemented using TMFMiniAppSDKManager's `sandBoxPathWithAppID:` interface to get the sandbox path, then splice `usr/miniprogramLog/` to get it - Implemented using TMFMiniAppSDKManager's `sandBoxPathWithAppID:` interface to get the sandbox path, then splice `usr/miniprogramLog/` to get it - Implemented using TMFMiniAppSDKManager's ` sandBoxPathWithAppID: TMFMiniAppSDKManager's `sandBoxPathWithAppID:` interface to get the sandbox path, then splice `usr/miniprogramLog/` to get it.
// @param appID appID of the mini program - appID of the applet/game.

- (void)uploadLogFileWithAppID:(NSString *)appID;

Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

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 available.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon