Set whether log messages should be in a structured-logging-like format. This is turned off by default.
The resulting format looks like this (when timestamps are enabled via ``--log-timestamps`` and with ``levelPrefix="prio"`` and ``timeFormat="ISO8601"``)::
- tm="2023-11-06T12:04:58+0100" prio="info" msg="Added downstream server 127.0.0.1:53"
+ ts="2023-11-06T12:04:58+0100" prio="Info" msg="Added downstream server 127.0.0.1:53"
And with ``levelPrefix="level"`` and ``timeFormat="numeric"``)::
- tm="1699268815.133" level="info" msg="Added downstream server 127.0.0.1:53"
+ ts="1699268815.133" level="Info" msg="Added downstream server 127.0.0.1:53"
:param bool enable: Set to true if you want to enable structured logging
:param table options: A table with key: value pairs with options described below.
}
if (dnsdist::logging::LoggingConfiguration::getStructuredLogging()) {
- stream << "tm=\"" << buffer.data() << "\" ";
+ stream << "ts=" << std::quoted(buffer.data()) << " ";
}
else {
stream << buffer.data();