ORE Studio 0.0.4
Loading...
Searching...
No Matches
log_record.hpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * Copyright (C) 2025 Marco Craveiro <marco.craveiro@gmail.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License as published by the Free Software
7 * Foundation; either version 3 of the License, or (at your option) any later
8 * version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 * details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 *
19 */
20#ifndef ORES_TELEMETRY_DOMAIN_LOG_RECORD_HPP
21#define ORES_TELEMETRY_DOMAIN_LOG_RECORD_HPP
22
23#include <chrono>
24#include <memory>
25#include <optional>
26#include <string>
27#include "ores.telemetry/domain/trace_id.hpp"
28#include "ores.telemetry/domain/span_id.hpp"
29#include "ores.logging/severity_level.hpp"
30#include "ores.telemetry/domain/attribute_value.hpp"
31#include "ores.telemetry/domain/resource.hpp"
32
34
36
46struct log_record final {
50 std::chrono::system_clock::time_point timestamp;
51
57 std::optional<std::chrono::system_clock::time_point> observed_timestamp;
58
62 severity_level severity = severity_level::info;
63
67 std::string body;
68
72 std::optional<trace_id> trace;
73
77 std::optional<span_id> span;
78
82 std::string logger_name;
83
88
94 std::shared_ptr<resource> source_resource;
95};
96
97}
98
99#endif
severity_level
Log severity levels following OpenTelemetry conventions.
Definition severity_level.hpp:34
Domain types for telemetry and observability.
Definition attribute_value.hpp:29
std::map< std::string, attribute_value > attributes
A collection of attributes as key-value pairs.
Definition attribute_value.hpp:52
A log record with trace correlation.
Definition log_record.hpp:46
std::shared_ptr< resource > source_resource
The resource that produced this log.
Definition log_record.hpp:94
std::string body
The log message body.
Definition log_record.hpp:67
attributes attrs
Additional attributes providing context.
Definition log_record.hpp:87
std::string logger_name
The name of the logger/component that emitted this log.
Definition log_record.hpp:82
std::optional< std::chrono::system_clock::time_point > observed_timestamp
When the event that the log describes occurred.
Definition log_record.hpp:57
std::chrono::system_clock::time_point timestamp
When the log was emitted.
Definition log_record.hpp:50
std::optional< span_id > span
The span this log was emitted from, if any.
Definition log_record.hpp:77
std::optional< trace_id > trace
The trace this log belongs to, if any.
Definition log_record.hpp:72
severity_level severity
The severity of the log message.
Definition log_record.hpp:62