folly/folly/logging/LogLevel.h

/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <cstdint>
#include <iosfwd>
#include <string>
#include <type_traits>

#include <folly/Portability.h>
#include <folly/Range.h>

namespace folly {

/**
 * Log level values.
 *
 * Higher levels are more important than lower ones.
 *
 * However, the numbers in the DBG* and INFO* level names are reversed, and can
 * be thought of as debug verbosity levels.  Increasing DBG* numbers mean
 * increasing level of verbosity.  DBG0 is the least verbose debug level, DBG1
 * is one level higher of verbosity, etc.
 */
enum class LogLevel : uint32_t {};

constexpr LogLevel kDefaultLogLevel =;
constexpr LogLevel kMinFatalLogLevel =;

/*
 * Support adding and subtracting integers from LogLevels, to create slightly
 * adjusted log level values.
 */
inline constexpr LogLevel operator+(LogLevel level, uint32_t value) {}
inline LogLevel& operator+=(LogLevel& level, uint32_t value) {}
inline constexpr LogLevel operator-(LogLevel level, uint32_t value) {}
inline LogLevel& operator-=(LogLevel& level, uint32_t value) {}

/**
 * Construct a LogLevel from a string name.
 */
LogLevel stringToLogLevel(folly::StringPiece name);

/**
 * Get a human-readable string representing the LogLevel.
 */
std::string logLevelToString(LogLevel level);

/**
 * Print a LogLevel in a human readable format.
 */
std::ostream& operator<<(std::ostream& os, LogLevel level);

/**
 * Returns true if and only if a LogLevel is fatal.
 */
inline constexpr bool isLogLevelFatal(LogLevel level) {}
} // namespace folly