1 /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ 2 /* 3 * Copyright 2018 Couchbase, Inc 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 #pragma once 18 19 #include "logger/visibility.h" 20 21 #include <nlohmann/json_fwd.hpp> 22 #include <spdlog/common.h> 23 24 #include <string> 25 26 namespace cb { 27 namespace logger { 28 29 struct LOGGER_PUBLIC_API Config { 30 Config() = default; 31 explicit Config(const nlohmann::json& json); 32 33 bool operator==(const Config& other) const; 34 bool operator!=(const Config& other) const; 35 36 /// The base name of the log files (we'll append: .000000.txt where 37 /// the numbers is a sequence counter. The higher the newer ;) 38 std::string filename; 39 /// 8192 item size for the logging queue. This is equivalent to 2 MB 40 size_t buffersize = 8192; 41 /// 100 MB per cycled file 42 size_t cyclesize = 100 * 1024 * 1024; 43 /// if running in a unit test or not 44 bool unit_test = false; 45 /// Should messages be passed on to the console via stderr 46 bool console = true; 47 /// The default log level to initialize the logger to 48 spdlog::level::level_enum log_level = spdlog::level::level_enum::info; 49 }; 50 51 } // namespace logger 52 } // namespace cb 53