userver: /data/code/userver/libraries/protobuf/src/protobuf/log.cpp Source File
Loading...
Searching...
No Matches
log.cpp
1#include <userver/protobuf/log.hpp>
2
3#include <userver/protobuf/json/convert.hpp>
4
5USERVER_NAMESPACE_BEGIN
6
7namespace logging {
8
9logging::LogHelper& operator<<(logging::LogHelper& h, const google::protobuf::Message& message) {
10 try {
11 constexpr std::size_t kDefaultLoggingStringLimit = 1024;
12 return h << protobuf::json::MessageToDebugString(message, kDefaultLoggingStringLimit);
13 } catch (const std::exception& ex) {
14 return h << "Failed to log message: " << ex;
15 }
16}
17
18} // namespace logging
19
20USERVER_NAMESPACE_END