title: Taro.getLogManager(res)

sidebar_label: getLogManager

Obtains the log manager object.

Reference

Type

  1. (res?: Option) => LogManager

Parameters

Option

Property Type Default Required Description
level 0 | 1 0 No Values: 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

  1. const logger = Taro.getLogManager({level: 1})
  2. logger.log({str: 'hello world'}, 'basic log', 100, [1, 2, 3])
  3. logger.info({str: 'hello world'}, 'info log', 100, [1, 2, 3])
  4. logger.debug({str: 'hello world'}, 'debug log', 100, [1, 2, 3])
  5. logger.warn({str: 'hello world'}, 'warn log', 100, [1, 2, 3])

API Support

API WeChat Mini-Program H5 React Native
Taro.getLogManager ✔️