Sha256: f472493ba46d06fee8a1c70d87eba65f36363c3b4eee5e1d646d514d5af4c7fb

Contents?: true

Size: 1.03 KB

Versions: 24

Compression:

Stored size: 1.03 KB

Contents

// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)

#pragma once

#include <spdlog/common.h>
#include <string>
#include <unordered_map>

namespace spdlog {
namespace cfg {
class log_levels
{
    std::unordered_map<std::string, spdlog::level::level_enum> levels_;
    spdlog::level::level_enum default_level_ = level::info;

public:
    void set(const std::string &logger_name, level::level_enum lvl)
    {
        if (logger_name.empty())
        {
            default_level_ = lvl;
        }
        else
        {
            levels_[logger_name] = lvl;
        }
    }

    void set_default(level::level_enum lvl)
    {
        default_level_ = lvl;
    }

    level::level_enum get(const std::string &logger_name)
    {
        auto it = levels_.find(logger_name);
        return it != levels_.end() ? it->second : default_level_;
    }

    level::level_enum default_level()
    {
        return default_level_;
    }
};
} // namespace cfg
} // namespace spdlog

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
couchbase-3.0.0-universal-darwin-19 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.beta.1-universal-darwin-19 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.beta.1 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.5-x86_64-linux ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.5-universal-darwin-19 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.5-x86_64-darwin-19 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.5 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.4-x86_64-linux ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.4-x86_64-darwin-19 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.4-universal-darwin-19 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.4 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.3-x86_64-linux ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.3-x86_64-darwin-19 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.3-universal-darwin-19 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.3 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.2-x86_64-linux ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.2-x86_64-darwin-19 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.2-universal-darwin-19 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h
couchbase-3.0.0.alpha.2 ext/third_party/spdlog/include/spdlog/cfg/log_levels.h