Skip to main content
Version: Next

Taro.getLogManager(res)

Obtains the log manager object.

Reference

Type

(res?: Option) => LogManager

Parameters

Option

PropertyTypeDefaultRequiredDescription
level0 | 10NoValues: 0 (Default) or 1. The former indicates the App and Page lifecycle functions and function calls under the wx namespace are written to the log, while the latter means these items are not written.

Sample Code

const logger = Taro.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])

API Support

APIWeChat Mini-ProgramH5React Native
Taro.getLogManager✔️