21 Star 24 Fork 111

OpenHarmony / hiviewdfx_hilog

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

HiLog

Introduction

HiLog is the module of OpenHarmony that logs information such as user operations and system running status for the system framework, services, and applications.

Figure 1 Architecture of the HiLog module

User-space processes write logs to the ring buffer of hilogd through the log API. hilogd sends logs to the console for viewing or writes logs to the flash at the request of the hilog.

The details are as follows:

  • hilogd: log service in the user space
  1. hilogd is a resident service and is enabled by default when the system is started.
  2. User-space processes call the log APIs to transfer the formatted log content to hilogd and store the content in its ring buffer.
  • hilog: command line tool for viewing logs
  1. hilog reads the log content from the ring buffer of hilogd, filters the content if required, and then prints the content to the standard output.

Supported functions:

  • Formatting of parameter privacy identifiers (See the following example for details.)
  • Flow control on excess log processes
  • Flow control on excess domains (subsystems or modules) involved in log printing
  • Log compression and flushing

Directory Structure

/base/hiviewdfx/hilog
├── frameworks           # Framework code
│   └── native          # HiLog Native implementation code
├── interfaces           # APIs
│   └── native          # External C/C++ APIs
│       └── innerkits   # Header files opened to internal subsystems
│       └── kits        # Header files opened to applications
│   └── js              # External js APIs
├── services
│   └── hilogd          # HiLog resident service implementation
│   └── hilogtool       # HiLog tool implementation

Constraints

Clang 8.0.0 or later is required.

Usage

Available APIs

Table 1 Major APIs of HiLog

Class

Method

Description

HiLogLabel

HiLogLabel(int type, int domain, String tag)

Constructs a log label, including the log type, domain, and tag.

HiLog

Info(const HiLogLabel &label, const char *fmt, ...)

Prints logs of the info level.

Usage Guidelines

  1. View logs.

Run the hilog | grep "MY_TAG" command in shell mode.

Output in debug mode:
01-26 11:01:06.870 1051 1051 W 00201/test: Failed to visit [https://gitee.com/openharmony](https://gitee.com/openharmony), reason:503.
Output in release mode:
01-26 11:01:06.870 1051 1051 W 00201/test: Failed to visit <private>, reason:503.

Repositories Involved

DFX subsystem

hiviewdfx_hiview

hiviewdfx_hilog

hiviewdfx_hiappevent

hiviewdfx_hisysevent

hiviewdfx_faultloggerd

hiviewdfx_hilog_lite

hiviewdfx_hievent_lite

hiviewdfx_hiview_lite

About

Logging function | 系统日志功能 expand collapse
C++ and 3 more languages
Apache-2.0
Cancel

Releases

No release

OpenHarmony

Contributors

All

Activities

Load More
can not load any more
1
https://gitee.com/openharmony/hiviewdfx_hilog.git
git@gitee.com:openharmony/hiviewdfx_hilog.git
openharmony
hiviewdfx_hilog
hiviewdfx_hilog
master

Search

E71a60c3 8189591 Df7b7c6b 8189591