Logger System 0.1.3
High-performance C++20 thread-safe logging system with asynchronous capabilities
Loading...
Searching...
No Matches
logfmt_formatter.h File Reference

Logfmt formatter for structured logging kcenon. More...

#include "../interfaces/log_entry.h"
#include "../interfaces/log_formatter_interface.h"
#include "../utils/time_utils.h"
#include "../utils/string_utils.h"
#include <sstream>
#include <iomanip>
#include <type_traits>
#include <variant>
#include <kcenon/common/interfaces/logger_interface.h>
Include dependency graph for logfmt_formatter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  kcenon::logger::logfmt_formatter
 Formatter that outputs logfmt-structured log messages. More...
 

Namespaces

namespace  kcenon
 
namespace  kcenon::logger
 

Detailed Description

Logfmt formatter for structured logging kcenon.

Since
3.1.0

Formats log messages in logfmt format (key=value pairs) for integration with log aggregation systems that support this format (Prometheus, Grafana Loki, Heroku, etc.).

Output format: level=info ts=2025-01-11T10:30:15.123Z msg="Application started" thread_id=12345

With structured fields: level=error ts=2025-01-11T10:30:15.123Z msg="Connection failed" user_id=123 retry_count=3

See also
https://brandur.org/logfmt

Definition in file logfmt_formatter.h.