import Vnmf from '../../index' declare module '../../index' { namespace setEnableDebug { type Option = { /** Whether to open debugging */ enableDebug: boolean /** The callback function of the interface call (Call success 、Failure will be executed ) */ complete?: (res: VnmfGeneral.CallbackResult) => void /** Interface call failure recovery function */ fail?: (res: VnmfGeneral.CallbackResult) => void /** Interface call successful callback function */ success?: (res: VnmfGeneral.CallbackResult) => void } interface Promised extends VnmfGeneral.CallbackResult { /** Call result */ errMsg: string } } namespace getLogManager { type Option = { /** * @default 0 */ level?: keyof Level } type Level = { /** Indicate that it will App、Page Life cycle function and wx The function call in the naming space is written into the log */ 0 /** It means that it will not App、Page Life cycle function and wx The function call in the naming space is written into the log */ 1 } } /** Print the log to the test panel 。console Is a global object ,Can directly access 。In WeChat client ,Towards vConsole Medium output log 。 * * **Notice ** * - because vConsole Functional ,And different client pairs console There are differences in supporting support ,It is recommended that developers only use the method provided in this document in the applet 。 * - Please refer to debugging for restrictions on some content display * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.html */ interface console { /** Print to the test panel debug Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.debug.html */ debug( /** Log content ,Can have any multiple 。 */ ...args: any[] ): void /** Print to the test panel error Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.error.html */ error( /** Log content ,Can have any multiple 。 */ ...args: any[] ): void /** Create a new group in the debug panel * * **Notice ** * Effectively in the tool ,exist vConsole Realize in the air function 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.group.html */ group( /** Packet mark */ label?: string, ): void /** End [console.group](#group) Created group * * **Notice ** * Effectively in the tool ,exist vConsole Realize in the air function 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.groupEnd.html */ groupEnd(): void /** Print to the test panel info Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.info.html */ info( /** Log content ,Can have any multiple 。 */ ...args: any[] ): void /** Print to the test panel log Log * @supported weapp, tt * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.log.html */ log( /** Log content ,Can have any multiple 。 */ ...args: any[] ): void /** Print to the test panel warn Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/console.warn.html */ warn( /** Log content ,Can have any multiple 。 */ ...args: any[] ): void } /** * Log Manager instance ,able to pass Vnmf.getLogManager Obtain 。 * * Instructions for use * Most preservation 5MLog content ,Exceed 5Mback ,The old log content will be deleted 。 * For applets ,User can use button Component open-type="feedback" Come up to the log in printing 。 * For mini -games ,User can use Vnmf.createFeedbackButton Create the button of uploading and printing logs 。 * Developers can manage the back menu on the left side of the background of the small program “Feedback management ”Page View related print logs 。 * * Basic library default will App、Page Life cycle function and wx The function call in the naming space is written into the log 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.html */ interface LogManager { /** Write debug Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.debug.html */ debug( /** Log content ,Can have any multiple 。The total size of the parameter called each time does not exceed 100Kb */ ...args: any[] ): void /** Write info Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.info.html */ info( /** Log content ,Can have any multiple 。The total size of the parameter called each time does not exceed 100Kb */ ...args: any[] ): void /** Write log Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.log.html */ log( /** Log content ,Can have any multiple 。The total size of the parameter called each time does not exceed 100Kb */ ...args: any[] ): void /** Write warn Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/LogManager.warn.html */ warn( /** Log content ,Can have any multiple 。The total size of the parameter called each time does not exceed 100Kb */ ...args: any[] ): void } /** * Real -time log manager instance ,able to pass Vnmf.getRealtimeLogManager Obtain 。 * * Instructions for use * To help small program developers quickly check the small program loopholes 、Positioning issue ,We launched the real -time log function 。From the base library 2.7.1start ,Developers can print logs through the interface provided ,Log convergence and real -time report to the small program background 。 * Developers can manage the background from small programs “Develop ->Operation and maintenance center ->Real -time log ”Enter the log query page ,Check the log information printed by the developer 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.html */ interface RealtimeLogManager { /** Add filter keywords * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.addFilterMsg.html */ addFilterMsg( /** Yes setFilterMsg Add interface 。Used to set multiple filter keywords 。 */ msg: string ): void /** Write error Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.error.html */ error( /** Log content ,Can have any multiple 。The total size of the parameter called each time does not exceed 5Kb */ ...args: any[] ): void /** Set up real -time logs pagePage of the parameter * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.in.html */ in( /** page Instance */ pageInstance ): void /** Write info Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.info.html */ info( /** Log content ,Can have any multiple 。The total size of the parameter called each time does not exceed 5Kb */ ...args: any[] ): void /** Set the filter keyword * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.setFilterMsg.html */ setFilterMsg( /** Filter keyword ,No more than 1Kb,You can search for the corresponding log in the small program management background to search according to the set content 。 */ msg: string ): void /** Receive the log manager instance of the given label ,Currently only supports use in plug -in * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.tag.html */ tag( /** Label */ tagName: string ): RealtimeTagLogManager /** Write warn Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeLogManager.warn.html */ warn( /** Log content ,Can have any multiple 。The total size of the parameter called each time does not exceed 5Kb */ ...args: any[] ): void } /** Real -time log manager example given a given label ,able to pass Real -time log manager example given a given label ,able to pass [RealtimeLogManager.tag](./RealtimeLogManager#tag) Interface acquisition ,Currently only supports use in plug -in 。 Interface acquisition ,Currently only supports use in plug -in 。 * * **Instructions for use ** * RealtimeTagLogManager Function and [RealtimeLogManager](./RealtimeLogManager) resemblance ,But in order to make the output real -time logs easier to analyze ,It has stricter format requirements 。 * RealtimeTagLogManager You need to pass the label when using ,The logs that call this instance output will be gathered to the corresponding label ,At the same time, the log of this instance only supports key-value Format output 。 * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.html */ interface RealtimeTagLogManager { /** Add filter keywords * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.addFilterMsg.html */ addFilterMsg( /** Yes setFilterMsg Add interface 。Used to set multiple filter keywords 。 */ msg: string ): void /** Write error Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.error.html */ error( /** Diary key */ key: string, /** Diary key */ value: Object | any[] | number | string, ): void /** Write info Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.info.html */ info( /** Diary key */ key: string, /** Diary key */ value: Object | any[] | number | string, ): void /** Set the filter keyword * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.setFilterMsg.html */ setFilterMsg( /** Filter keyword ,No more than 1Kb,You can search for the corresponding log in the small program management background to search according to the set content 。 */ msg: string ): void /** Write warn Log * @supported weapp * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/RealtimeTagLogManager.warn.html */ warn( /** Diary key */ key: string, /** Diary key */ value: Object | any[] | number | string, ): void } interface VnmfStatic { /** * Set whether to turn on the debug switch ,This switch can also take effect on the official version 。 * @supported weapp * @example * ```tsx * // Turn on debugging * Vnmf.setEnableDebug({ * enableDebug: true * }) * // Turn off debugging * Vnmf.setEnableDebug({ * enableDebug: false * }) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.setEnableDebug.html */ setEnableDebug(res: setEnableDebug.Option): Promise /** * Get the real log manager object 。 * @supported weapp * @example * ```tsx * const logger = Vnmf.getRealtimeLogManager() * logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3]) * logger.error({str: 'hello world'}, 'error log', 100, [1, 2, 3]) * logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3]) * ``` */ getRealtimeLogManager(): RealtimeLogManager /** * Get the log manager object 。 * @supported weapp * @example * ```tsx * const logger = Vnmf.getLogManager({level: 1}) * * logger.log({str: 'hello world'}, 'basic log', 100, [1, 2, 3]) * logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3]) * logger.debug({str: 'hello world'}, 'debug log', 100, [1, 2, 3]) * logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3]) * ``` * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/debug/wx.getLogManager.html */ getLogManager(res?: getLogManager.Option): LogManager } }