ChainCLI
A modern C++20 command-line interface library
Loading...
Searching...
No Matches
logrecord.h
1/*
2 * Copyright 2025 Dominik Czekai
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18#include <chrono>
19#include <string>
20
21#include "loglevel.h"
22
23namespace cli::logging
24{
25
28{
30 const LogLevel level;
32 const std::string message;
34 const std::chrono::system_clock::time_point timestamp{std::chrono::system_clock::now()};
35
39 LogRecord(LogLevel lvl, std::string msg) : level(lvl), message(std::move(msg)) {}
40};
41
42} // namespace cli::logging
Data structure representing a log record.
Definition logrecord.h:28
LogRecord(LogLevel lvl, std::string msg)
Construct a new LogRecord.
Definition logrecord.h:39
const std::chrono::system_clock::time_point timestamp
The timestamp of the log record.
Definition logrecord.h:34
const std::string message
The log message.
Definition logrecord.h:32
const LogLevel level
The log level of the record.
Definition logrecord.h:30