Class Logger

Inheritance Relationships

Derived Types

Class Documentation

class Logger

Handles log record creation.

Subclassed by opentelemetry::logs::NoopLogger, opentelemetry::sdk::logs::Logger

Public Functions

virtual ~Logger() = default
virtual const nostd::string_view GetName() noexcept = 0
virtual nostd::unique_ptr<LogRecord> CreateLogRecord() noexcept = 0

Create a Log Record object

Returns:

nostd::unique_ptr<LogRecord>

virtual void EmitLogRecord(nostd::unique_ptr<LogRecord> &&log_record) noexcept = 0

Emit a Log Record object

Parameters:

log_record

template<class ...ArgumentType>
inline void EmitLogRecord(nostd::unique_ptr<LogRecord> &&log_record, ArgumentType&&... args)

Emit a Log Record object with arguments

Parameters:

log_record – Log record

Template Parameters:

args – Arguments which can be used to set data of log record by type. Severity -> severity, severity_text string_view -> body AttributeValue -> body SpanContext -> span_id,trace_id and trace_flags SpanId -> span_id TraceId -> trace_id TraceFlags -> trace_flags SystemTimestamp -> timestamp system_clock::time_point -> timestamp KeyValueIterable -> attributes Key value iterable container -> attributes span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)

template<class ...ArgumentType>
inline void EmitLogRecord(ArgumentType&&... args)

Emit a Log Record object with arguments

Template Parameters:

args – Arguments which can be used to set data of log record by type. Severity -> severity, severity_text string_view -> body AttributeValue -> body SpanContext -> span_id,trace_id and trace_flags SpanId -> span_id TraceId -> trace_id TraceFlags -> trace_flags SystemTimestamp -> timestamp system_clock::time_point -> timestamp KeyValueIterable -> attributes Key value iterable container -> attributes span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)

template<class ...ArgumentType>
inline void Trace(ArgumentType&&... args) noexcept

Writes a log with a severity of trace.

Template Parameters:

args – Arguments which can be used to set data of log record by type. string_view -> body AttributeValue -> body SpanContext -> span_id,trace_id and trace_flags SpanId -> span_id TraceId -> trace_id TraceFlags -> trace_flags SystemTimestamp -> timestamp system_clock::time_point -> timestamp KeyValueIterable -> attributes Key value iterable container -> attributes span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)

template<class ...ArgumentType>
inline void Debug(ArgumentType&&... args) noexcept

Writes a log with a severity of debug.

Template Parameters:

args – Arguments which can be used to set data of log record by type. string_view -> body AttributeValue -> body SpanContext -> span_id,trace_id and trace_flags SpanId -> span_id TraceId -> trace_id TraceFlags -> trace_flags SystemTimestamp -> timestamp system_clock::time_point -> timestamp KeyValueIterable -> attributes Key value iterable container -> attributes span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)

template<class ...ArgumentType>
inline void Info(ArgumentType&&... args) noexcept

Writes a log with a severity of info.

Template Parameters:

args – Arguments which can be used to set data of log record by type. string_view -> body AttributeValue -> body SpanContext -> span_id,trace_id and trace_flags SpanId -> span_id TraceId -> trace_id TraceFlags -> trace_flags SystemTimestamp -> timestamp system_clock::time_point -> timestamp KeyValueIterable -> attributes Key value iterable container -> attributes span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)

template<class ...ArgumentType>
inline void Warn(ArgumentType&&... args) noexcept

Writes a log with a severity of warn.

Template Parameters:

args – Arguments which can be used to set data of log record by type. string_view -> body AttributeValue -> body SpanContext -> span_id,trace_id and trace_flags SpanId -> span_id TraceId -> trace_id TraceFlags -> trace_flags SystemTimestamp -> timestamp system_clock::time_point -> timestamp KeyValueIterable -> attributes Key value iterable container -> attributes span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)

template<class ...ArgumentType>
inline void Error(ArgumentType&&... args) noexcept

Writes a log with a severity of error.

Template Parameters:

args – Arguments which can be used to set data of log record by type. string_view -> body AttributeValue -> body SpanContext -> span_id,trace_id and trace_flags SpanId -> span_id TraceId -> trace_id TraceFlags -> trace_flags SystemTimestamp -> timestamp system_clock::time_point -> timestamp KeyValueIterable -> attributes Key value iterable container -> attributes span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)

template<class ...ArgumentType>
inline void Fatal(ArgumentType&&... args) noexcept

Writes a log with a severity of fatal.

Template Parameters:

args – Arguments which can be used to set data of log record by type. string_view -> body AttributeValue -> body SpanContext -> span_id,trace_id and trace_flags SpanId -> span_id TraceId -> trace_id TraceFlags -> trace_flags SystemTimestamp -> timestamp system_clock::time_point -> timestamp KeyValueIterable -> attributes Key value iterable container -> attributes span<pair<string_view, AttributeValue>> -> attributes(return type of MakeAttributes)

inline bool Enabled(Severity severity, const EventId &event_id) const noexcept
inline bool Enabled(Severity severity, int64_t event_id) const noexcept
inline bool Enabled(Severity severity) const noexcept
inline virtual void Log(Severity severity, const EventId &event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept

Log an event

@severity severity of the log @event_id event identifier of the log @format an utf-8 string following https://messagetemplates.org/ @attributes key value pairs of the log

inline virtual void Log(Severity severity, int64_t event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline virtual void Log(Severity severity, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline virtual void Log(Severity severity, nostd::string_view message) noexcept
inline void Trace(const EventId &event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Trace(int64_t event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Trace(nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Trace(nostd::string_view message) noexcept
inline void Debug(const EventId &event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Debug(int64_t event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Debug(nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Debug(nostd::string_view message) noexcept
inline void Info(const EventId &event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Info(int64_t event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Info(nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Info(nostd::string_view message) noexcept
inline void Warn(const EventId &event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Warn(int64_t event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Warn(nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Warn(nostd::string_view message) noexcept
inline void Error(const EventId &event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Error(int64_t event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Error(nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Error(nostd::string_view message) noexcept
inline void Fatal(const EventId &event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Fatal(int64_t event_id, nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Fatal(nostd::string_view format, const common::KeyValueIterable &attributes) noexcept
inline void Fatal(nostd::string_view message) noexcept

Protected Functions

inline virtual bool EnabledImplementation(Severity, const EventId&) const noexcept
inline virtual bool EnabledImplementation(Severity, int64_t) const noexcept
inline void SetMinimumSeverity(uint8_t severity_or_max) noexcept