tencent cloud

Logging and Event Reporting
Terakhir diperbarui:2025-03-17 15:45:40
Logging and Event Reporting
Terakhir diperbarui: 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;

Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
Ya
Tidak

masukan