161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit PerformanceAnalysisKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport type { AsyncCallback } from './@ohos.base';
2261847f8eSopenharmony_ci
2361847f8eSopenharmony_ci/**
2461847f8eSopenharmony_ci * @namespace logLibrary
2561847f8eSopenharmony_ci * @syscap SystemCapability.HiviewDFX.Hiview.LogLibrary
2661847f8eSopenharmony_ci * @systemapi
2761847f8eSopenharmony_ci * @since 10
2861847f8eSopenharmony_ci */
2961847f8eSopenharmony_cideclare namespace logLibrary {
3061847f8eSopenharmony_ci  /**
3161847f8eSopenharmony_ci   * Log file entry
3261847f8eSopenharmony_ci   *
3361847f8eSopenharmony_ci   * @typedef LogEntry
3461847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.Hiview.LogLibrary
3561847f8eSopenharmony_ci   * @systemapi
3661847f8eSopenharmony_ci   * @since 10
3761847f8eSopenharmony_ci   */
3861847f8eSopenharmony_ci  interface LogEntry {
3961847f8eSopenharmony_ci    /**
4061847f8eSopenharmony_ci     * Log file name
4161847f8eSopenharmony_ci     *
4261847f8eSopenharmony_ci     * @type { string }
4361847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.Hiview.LogLibrary
4461847f8eSopenharmony_ci     * @systemapi
4561847f8eSopenharmony_ci     * @since 10
4661847f8eSopenharmony_ci     */
4761847f8eSopenharmony_ci    name: string;
4861847f8eSopenharmony_ci
4961847f8eSopenharmony_ci    /**
5061847f8eSopenharmony_ci     * File modification time, expressed by the number of seconds elapsed from 1970-01-01
5161847f8eSopenharmony_ci     *
5261847f8eSopenharmony_ci     * @type { number }
5361847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.Hiview.LogLibrary
5461847f8eSopenharmony_ci     * @systemapi
5561847f8eSopenharmony_ci     * @since 10
5661847f8eSopenharmony_ci     */
5761847f8eSopenharmony_ci    mtime: number;
5861847f8eSopenharmony_ci
5961847f8eSopenharmony_ci    /**
6061847f8eSopenharmony_ci     * Log file size, byte
6161847f8eSopenharmony_ci     *
6261847f8eSopenharmony_ci     * @type { number }
6361847f8eSopenharmony_ci     * @syscap SystemCapability.HiviewDFX.Hiview.LogLibrary
6461847f8eSopenharmony_ci     * @systemapi
6561847f8eSopenharmony_ci     * @since 10
6661847f8eSopenharmony_ci     */
6761847f8eSopenharmony_ci    size: number;
6861847f8eSopenharmony_ci  }
6961847f8eSopenharmony_ci
7061847f8eSopenharmony_ci  /**
7161847f8eSopenharmony_ci   * List all log names of log type
7261847f8eSopenharmony_ci   *
7361847f8eSopenharmony_ci   * @permission ohos.permission.READ_HIVIEW_SYSTEM
7461847f8eSopenharmony_ci   * @param { string } logType - Log type
7561847f8eSopenharmony_ci   * @returns { LogEntry[] } Return LogEntry[]
7661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied
7761847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api
7861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Invalid argument. Possible causes:
7961847f8eSopenharmony_ci   * <br>1. Mandatory parameters are left unspecified.
8061847f8eSopenharmony_ci   * <br>2. Incorrect parameter types.
8161847f8eSopenharmony_ci   * <br>3. Parameter verification failed.
8261847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.Hiview.LogLibrary
8361847f8eSopenharmony_ci   * @systemapi
8461847f8eSopenharmony_ci   * @since 10
8561847f8eSopenharmony_ci   */
8661847f8eSopenharmony_ci  function list(logType: string): LogEntry[];
8761847f8eSopenharmony_ci
8861847f8eSopenharmony_ci  /**
8961847f8eSopenharmony_ci   * Copy log to dest path
9061847f8eSopenharmony_ci   *
9161847f8eSopenharmony_ci   * @permission ohos.permission.READ_HIVIEW_SYSTEM
9261847f8eSopenharmony_ci   * @param { string } logType - Log type
9361847f8eSopenharmony_ci   * @param { string } logName - Log name
9461847f8eSopenharmony_ci   * @param { string } dest - Log path under hiview sandbox of HAP
9561847f8eSopenharmony_ci   * @returns { Promise<void> } Return Promise
9661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied
9761847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api
9861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Invalid argument. Possible causes:
9961847f8eSopenharmony_ci   * <br>1. Mandatory parameters are left unspecified.
10061847f8eSopenharmony_ci   * <br>2. Incorrect parameter types.
10161847f8eSopenharmony_ci   * <br>3. Parameter verification failed.
10261847f8eSopenharmony_ci   * @throws { BusinessError } 21300001 - Source file does not exists
10361847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.Hiview.LogLibrary
10461847f8eSopenharmony_ci   * @systemapi
10561847f8eSopenharmony_ci   * @since 10
10661847f8eSopenharmony_ci   */
10761847f8eSopenharmony_ci  function copy(logType: string, logName: string, dest: string): Promise<void>;
10861847f8eSopenharmony_ci
10961847f8eSopenharmony_ci  /**
11061847f8eSopenharmony_ci   * Copy log to dest path
11161847f8eSopenharmony_ci   *
11261847f8eSopenharmony_ci   * @permission ohos.permission.READ_HIVIEW_SYSTEM
11361847f8eSopenharmony_ci   * @param { string } logType - Log type
11461847f8eSopenharmony_ci   * @param { string } logName - Log name
11561847f8eSopenharmony_ci   * @param { string } dest - Log path under hiview sandbox of HAP
11661847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - After finish copy log will callback
11761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied
11861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api
11961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Invalid argument. Possible causes:
12061847f8eSopenharmony_ci   * <br>1. Mandatory parameters are left unspecified.
12161847f8eSopenharmony_ci   * <br>2. Incorrect parameter types.
12261847f8eSopenharmony_ci   * <br>3. Parameter verification failed.
12361847f8eSopenharmony_ci   * @throws { BusinessError } 21300001 - Source file does not exists
12461847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.Hiview.LogLibrary
12561847f8eSopenharmony_ci   * @systemapi
12661847f8eSopenharmony_ci   * @since 10
12761847f8eSopenharmony_ci   */
12861847f8eSopenharmony_ci  function copy(logType: string, logName: string, dest: string, callback: AsyncCallback<void>): void;
12961847f8eSopenharmony_ci
13061847f8eSopenharmony_ci  /**
13161847f8eSopenharmony_ci   * Move log to dest path
13261847f8eSopenharmony_ci   *
13361847f8eSopenharmony_ci   * @permission ohos.permission.WRITE_HIVIEW_SYSTEM
13461847f8eSopenharmony_ci   * @param { string } logType - Log type
13561847f8eSopenharmony_ci   * @param { string } logName - Log name
13661847f8eSopenharmony_ci   * @param { string } dest - Log path under hiview sandbox of HAP
13761847f8eSopenharmony_ci   * @returns { Promise<void> } Return Promise
13861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied
13961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api
14061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Invalid argument. Possible causes:
14161847f8eSopenharmony_ci   * <br>1. Mandatory parameters are left unspecified.
14261847f8eSopenharmony_ci   * <br>2. Incorrect parameter types.
14361847f8eSopenharmony_ci   * <br>3. Parameter verification failed.
14461847f8eSopenharmony_ci   * @throws { BusinessError } 21300001 - Source file does not exists
14561847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.Hiview.LogLibrary
14661847f8eSopenharmony_ci   * @systemapi
14761847f8eSopenharmony_ci   * @since 10
14861847f8eSopenharmony_ci   */
14961847f8eSopenharmony_ci  function move(logType: string, logName: string, dest: string): Promise<void>;
15061847f8eSopenharmony_ci
15161847f8eSopenharmony_ci  /**
15261847f8eSopenharmony_ci   * Move log to dest path
15361847f8eSopenharmony_ci   *
15461847f8eSopenharmony_ci   * @permission ohos.permission.WRITE_HIVIEW_SYSTEM
15561847f8eSopenharmony_ci   * @param { string } logType - Log type
15661847f8eSopenharmony_ci   * @param { string } logName - Log name
15761847f8eSopenharmony_ci   * @param { string } dest - Log path under hiview sandbox of HAP
15861847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - After finish move log will callback
15961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied
16061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api
16161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Invalid argument. Possible causes:
16261847f8eSopenharmony_ci   * <br>1. Mandatory parameters are left unspecified.
16361847f8eSopenharmony_ci   * <br>2. Incorrect parameter types.
16461847f8eSopenharmony_ci   * <br>3. Parameter verification failed.
16561847f8eSopenharmony_ci   * @throws { BusinessError } 21300001 - Source file does not exists
16661847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.Hiview.LogLibrary
16761847f8eSopenharmony_ci   * @systemapi
16861847f8eSopenharmony_ci   * @since 10
16961847f8eSopenharmony_ci   */
17061847f8eSopenharmony_ci  function move(logType: string, logName: string, dest: string, callback: AsyncCallback<void>): void;
17161847f8eSopenharmony_ci
17261847f8eSopenharmony_ci  /**
17361847f8eSopenharmony_ci   * Delete the log based on log name and log type
17461847f8eSopenharmony_ci   *
17561847f8eSopenharmony_ci   * @permission ohos.permission.WRITE_HIVIEW_SYSTEM
17661847f8eSopenharmony_ci   * @param { string } logType - Log type
17761847f8eSopenharmony_ci   * @param { string } logName - Log name
17861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied
17961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission denied, non-system app called system api
18061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Invalid argument. Possible causes:
18161847f8eSopenharmony_ci   * <br>1. Mandatory parameters are left unspecified.
18261847f8eSopenharmony_ci   * <br>2. Incorrect parameter types.
18361847f8eSopenharmony_ci   * <br>3. Parameter verification failed.
18461847f8eSopenharmony_ci   * @throws { BusinessError } 21300001 - Source file does not exists
18561847f8eSopenharmony_ci   * @syscap SystemCapability.HiviewDFX.Hiview.LogLibrary
18661847f8eSopenharmony_ci   * @systemapi
18761847f8eSopenharmony_ci   * @since 10
18861847f8eSopenharmony_ci   */
18961847f8eSopenharmony_ci  function remove(logType: string, logName: string): void;
19061847f8eSopenharmony_ci}
19161847f8eSopenharmony_ci
19261847f8eSopenharmony_ciexport default logLibrary;