2 * Copyright 2004-present Facebook, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <unordered_map>
21 #include <folly/experimental/logging/LogCategoryConfig.h>
22 #include <folly/experimental/logging/LogHandlerConfig.h>
27 * LogConfig contains configuration for the LoggerDB.
29 * This includes information about the log levels for log categories,
30 * as well as what log handlers are configured and which categories they are
35 using CategoryConfigMap = std::unordered_map<std::string, LogCategoryConfig>;
36 using HandlerConfigMap = std::unordered_map<std::string, LogHandlerConfig>;
38 LogConfig() = default;
40 HandlerConfigMap handlerConfigs,
41 CategoryConfigMap catConfigs)
42 : handlerConfigs_{std::move(handlerConfigs)},
43 categoryConfigs_{std::move(catConfigs)} {}
45 const CategoryConfigMap& getCategoryConfigs() const {
46 return categoryConfigs_;
48 const HandlerConfigMap& getHandlerConfigs() const {
49 return handlerConfigs_;
52 bool operator==(const LogConfig& other) const;
53 bool operator!=(const LogConfig& other) const;
56 HandlerConfigMap handlerConfigs_;
57 CategoryConfigMap categoryConfigs_;