12498b56bSopenharmony_ci/*
22498b56bSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
32498b56bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
42498b56bSopenharmony_ci * you may not use this file except in compliance with the License.
52498b56bSopenharmony_ci * You may obtain a copy of the License at
62498b56bSopenharmony_ci *
72498b56bSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
82498b56bSopenharmony_ci *
92498b56bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
102498b56bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
112498b56bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
122498b56bSopenharmony_ci * See the License for the specific language governing permissions and
132498b56bSopenharmony_ci * limitations under the License.
142498b56bSopenharmony_ci */
152498b56bSopenharmony_ci#ifndef LOG_PRINT_H
162498b56bSopenharmony_ci#define LOG_PRINT_H
172498b56bSopenharmony_ci#include <iostream>
182498b56bSopenharmony_ci
192498b56bSopenharmony_ci#include "hilog_cmd.h"
202498b56bSopenharmony_ci
212498b56bSopenharmony_cinamespace OHOS {
222498b56bSopenharmony_cinamespace HiviewDFX {
232498b56bSopenharmony_cistruct LogContent {
242498b56bSopenharmony_ci    uint8_t level;
252498b56bSopenharmony_ci    uint8_t type;
262498b56bSopenharmony_ci    uint32_t pid;
272498b56bSopenharmony_ci    uint32_t tid;
282498b56bSopenharmony_ci    uint32_t domain;
292498b56bSopenharmony_ci    uint32_t tv_sec;
302498b56bSopenharmony_ci    uint32_t tv_nsec;
312498b56bSopenharmony_ci    uint32_t mono_sec;
322498b56bSopenharmony_ci    const char *tag;
332498b56bSopenharmony_ci    const char *log;
342498b56bSopenharmony_ci};
352498b56bSopenharmony_ci
362498b56bSopenharmony_cistruct LogFormat {
372498b56bSopenharmony_ci    bool colorful;
382498b56bSopenharmony_ci    FormatTime timeFormat;
392498b56bSopenharmony_ci    FormatTimeAccu timeAccuFormat;
402498b56bSopenharmony_ci    bool year;
412498b56bSopenharmony_ci    bool zone;
422498b56bSopenharmony_ci    bool wrap;
432498b56bSopenharmony_ci};
442498b56bSopenharmony_ci
452498b56bSopenharmony_civoid LogPrintWithFormat(const LogContent& content, const LogFormat& format, std::ostream& out = std::cout);
462498b56bSopenharmony_ci} // namespace HiviewDFX
472498b56bSopenharmony_ci} // namespace OHOS
482498b56bSopenharmony_ci#endif /* LOG_PRINT_H */