1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/openharmony-applications_app_samples

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Это зеркальный репозиторий, синхронизируется ежедневно с исходного репозитория.
Клонировать/Скачать
Внести вклад в разработку кода
Синхронизировать код
Отмена
Подсказка: Поскольку Git не поддерживает пустые директории, создание директории приведёт к созданию пустого файла .keep.
Loading...
README.md

Log

Introduction

This sample shows how to use log APIs to print log information and save the information to the application installation directory.

APIs

    import logger from '@ohos/log'
    import { LogLevel } from '@ohos/log'
    import { Configure }  from '@ohos/log'

Usage Instruction

  1. Configure log printing parameters.
  Configure = {
    cheese: {
        types: string[],
        filename: string
    }
    defaults: {
        appenders: string,
        level: LogLevel
    }
  } 
  // If types is set to file, logs are saved to the file named by filename. appenders indicates the log tag, and level indicates the lowest log level.
  1. Initialize a logger instance.
   logger.setConfigure(configure: Configure)
   // configure indicates the parameter configuration.
  1. Print log information of the debug level.
   logger.debug(value) 
   // value indicates the log content.
  1. Print log information of the info level.
   logger.info(value) 
   // value indicates the log content.
  1. Print log information of the warn level.
   logger.warn(value) 
   // value indicates the log content.
  1. Print log information of the error level.
   logger.error(value) 
   // value indicates the log content.
  1. Print log information of the fatal level.
   logger.fatal(value, bool) 
   // value indicates the log content.

Constraints

  1. This sample requires API version 9 or later.

  2. This sample requires DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100) to compile and run.

Комментарий ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/openharmony-applications_app_samples.git
git@gitlife.ru:oschina-mirror/openharmony-applications_app_samples.git
oschina-mirror
openharmony-applications_app_samples
openharmony-applications_app_samples
weekly_20240115-v