utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
logger.hpp File Reference

Logging interface with levels, source-location metadata, and stream-style output. More...

#include <atomic>
#include <limits>
#include <memory>
#include <mutex>
#include <source_location>
#include <sstream>
#include <string>
#include <type_traits>
#include <utility>
Include dependency graph for logger.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  utility::logging::LogRecord
 Structured log record carrying metadata for a single log entry. More...
 
class  utility::logging::Logger
 Abstract logger interface defining stream-style logging operations. More...
 
class  utility::logging::Logger::LogMessage
 Proxy object returned by debug/info/warning/error. More...
 

Namespaces

namespace  utility
 The utility namespace contains classes and functions for the utility project.
 

Concepts

concept  utility::logging::InheritFromLogger
 Concept to ensure a type inherits from Logger.
 

Enumerations

enum class  utility::logging::LogLevel { DEBUG_LEVEL , INFO_LEVEL , WARNING_LEVEL , ERROR_LEVEL }
 Log severity levels. More...
 
enum class  utility::logging::FlushPolicy { BUFFERED , ALWAYS , NEVER }
 Controls when a stream-backed logger flushes its output. More...
 

Detailed Description

Logging interface with levels, source-location metadata, and stream-style output.

Defines the utility::Logger abstract base class along with the LogLevel enumeration and LogRecord. Concrete loggers derive from Logger and implement output(const LogRecord&).

Usage: getLogger().debug() << "Entity " << id << " updated";

Definition in file logger.hpp.

Enumeration Type Documentation

◆ FlushPolicy

enum class utility::logging::FlushPolicy
strong

Controls when a stream-backed logger flushes its output.

Buffering avoids a per-line flush (std::endl) while still guaranteeing that warnings and errors reach the console promptly.

Enumerator
BUFFERED 

Buffer debug/info; flush warnings/errors (default)

ALWAYS 

Flush after every message (legacy behavior)

NEVER 

Never flush except on destruction.

Definition at line 68 of file logger.hpp.

◆ LogLevel

enum class utility::logging::LogLevel
strong

Log severity levels.

Enumerator
DEBUG_LEVEL 

Detailed debugging information.

INFO_LEVEL 

General informational messages.

WARNING_LEVEL 

Warning messages for potentially harmful situations

ERROR_LEVEL 

Error messages for serious problems.

Definition at line 54 of file logger.hpp.