In order to help Dongguan mini program developers quickly troubleshoot mini program vulnerabilities and locate problems, we have launched a real-time log function. Starting from basic library 2.7.1, developers can print logs through the provided interface, and the logs are aggregated and reported to the mini program backend in real time. Developers can enter the log query page from the mini-program management background "Development->Operation and Maintenance Center->Real-time Log" to view the log information printed by the developer. How to use1. Call related interfaces. The logging interface is wx.getRealtimeLogManager. To be compatible with older versions, it is recommended to encapsulate it using the following code, for example, in the log.js file: var log = wx.getRealtimeLogManager ? wx.getRealtimeLogManager() : nullmodule.exports = { info() { if (!log) return log.info.apply(log, arguments) }, warn() { if (!log) return log.warn.apply(log, arguments) }, error() { if (!log) return log.error.apply(log, arguments) }, setFilterMsg(msg) { // Supported since base library 2.7.3 if (!log || !log.setFilterMsg) return if (typeof msg !== 'string') return log.setFilterMsg(msg) }, addFilterMsg(msg) { // Supported since base library 2.8.1 if (!log || !log.addFilterMsg) return if (typeof msg !== 'string') return log.addFilterMsg(msg) }} 2. Print logs at specific locations on the page: var log = require('./log.js') // reference the log.js file above log.info('hello test hahaha') // The log will be associated with the currently opened page. It is recommended to log.warn('warn') in the life cycle of the page such as onHide and onShow. log.error('error')log.setFilterMsg('filterkeyword')log.setFilterMsg('addfilterkeyword') For a complete example, please refer to the code snippet: https://developers.weixin.qq.com/s/i42NbKmp76bJ How to view logsLog in to the mini program management backend and enter the log query page from "Development->Operation and Maintenance Center->Real-time Log". Developers can query the log information of a specified user by setting filtering conditions such as time, WeChat account/OpenID, page link, FilterMsg content (basic library 2.7.3 and above supports setFilterMsg). PrecautionsDue to background resource limitations, the usage rules of "real-time log" are as follows:
|
<<: Douyin Operation: Strategies for maintaining a Douyin account and increasing followers!
>>: Event promotion: How to add 70,000+ new users in 5 days?
In the past two years, short videos and live stre...
In this article, we will share from the following...
A data center, also known as a computer room, is ...
Course file directory: V-1394: A beginner's g...
2021 Ma Bingbing Golden March and Silver April In...
Amazon , an e-commerce company known as "the...
There are also four major advantages of bidding h...
For advertisers, professionalism is the embodimen...
Taking the growth of Internet products as an examp...
00【Editorial】Management is a daily routine, succe...
When farming on the Internet, traffic is like the...
In 20 days, the World Cup, which attracts the att...
A good website SEO diagnosis report can be regard...
: : : : : : : : : : : : : : : : : : : : : : : : : ...
1. Opening What is important in operations is a w...