1 /*
2  * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FAULT_LOGGER_CONFIG_H
17 #define FAULT_LOGGER_CONFIG_H
18 
19 #include <string>
20 #include <vector>
21 namespace OHOS {
22 namespace HiviewDFX {
23 constexpr int LOG_FILE_NUMBER = 50;
24 constexpr long LOG_FILE_SIZE = 1 * 1024 * 1024;
25 const std::string LOG_FILE_PATH = "/data/log/faultlog/temp";
26 const std::string DEBUG_LOG_FILE_PATH = "/data/log/faultlog/debug";
27 const std::vector<const std::string> VALID_FILE_PATH = { LOG_FILE_PATH, DEBUG_LOG_FILE_PATH };
28 
29 class FaultLoggerConfig {
30 public:
31     FaultLoggerConfig(const int number, const long size, const std::string& path, const std::string& debugPath);
32     ~FaultLoggerConfig();
33     int GetLogFileMaxNumber() const;
34     bool SetLogFileMaxNumber(const int number);
35     long GetLogFileMaxSize() const;
36     bool SetLogFileMaxSize(const long size);
37     std::string GetLogFilePath() const;
38     bool SetLogFilePath(const std::string& path);
39     bool SetDebugLogFilePath(const std::string& path);
40     std::string GetDebugLogFilePath() const;
41 
42 private:
43     int logFileNumber_;
44     long logFileSize_;
45     std::string logFilePath_;
46     std::string debugLogFilePath_;
47 };
48 } // namespace HiviewDFX
49 } // namespace OHOS
50 
51 #endif
52