iceberg-cpp
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs | Functions | Variables
logger.h File Reference

Pluggable logging interface and the process-global default logger. More...

#include <concepts>
#include <cstdlib>
#include <format>
#include <functional>
#include <memory>
#include <source_location>
#include <string>
#include <string_view>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>
#include "iceberg/iceberg_export.h"
#include "iceberg/logging/log_level.h"
#include "iceberg/result.h"

Go to the source code of this file.

Classes

struct  iceberg::LogAttribute
 A structured key/value attribute attached to a log record. More...
 
class  iceberg::LogMessage
 A single log record handed to a Logger. More...
 
class  iceberg::Logger
 Pluggable logging sink. More...
 
class  iceberg::ScopedLogger
 Bind a logger for the current thread until this object leaves scope. More...
 

Namespaces

namespace  iceberg
 Core Apache Iceberg C++ APIs.
 

Typedefs

using iceberg::FatalHandler = std::function< void(const std::source_location &, std::string_view message)>
 A hook invoked on the fatal-log path just before std::abort().
 

Functions

ICEBERG_EXPORT std::shared_ptr< Loggericeberg::GetDefaultLogger ()
 Return the process-global default logger (never null).
 
ICEBERG_EXPORT std::shared_ptr< Loggericeberg::GetCurrentLogger ()
 Return the effective logger for this thread (never null): the active ScopedLogger binding if any, else the global default.
 
ICEBERG_EXPORT void iceberg::SetDefaultLogger (std::shared_ptr< Logger > logger)
 Install a new process-global default logger.
 
ICEBERG_EXPORT void iceberg::SetDefaultLevel (LogLevel level)
 Set the minimum level of the current default logger.
 
ICEBERG_EXPORT void iceberg::SetFatalHandler (FatalHandler handler)
 Install (or clear, with nullptr) the process-global fatal handler.
 
ICEBERG_EXPORT FatalHandler iceberg::GetFatalHandler ()
 Return the installed fatal handler (empty if none). Used by the fatal logging path; thread-safe.
 
template<typename... Args>
void iceberg::Log (LogLevel level, internal::FmtWithLoc< std::type_identity_t< Args >... > fmt, Args &&... args) noexcept
 Log to the process-default logger, std::format style. Formats only if the level is enabled; never throws.
 
template<typename... Args>
void iceberg::Log (Logger &logger, LogLevel level, internal::FmtWithLoc< std::type_identity_t< Args >... > fmt, Args &&... args) noexcept
 Log to an explicit logger, std::format style. Formats only if enabled.
 

Variables

constexpr std::string_view iceberg::kLevelProperty = "level"
 Well-known Logger::Initialize() property keys.
 
constexpr std::string_view iceberg::kPatternProperty = "pattern"
 

Detailed Description

Pluggable logging interface and the process-global default logger.

This header is backend-agnostic: it never includes the build-generated backend configuration header and never references the spdlog feature macro, so consumers see one stable API regardless of how the backend was configured.