userver: userver/utils/log.hpp Source File
Loading...
Searching...
No Matches
log.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/utils/log.hpp
4/// @brief Algorithms to aid logging
5
6#include <cstddef>
7#include <string>
8#include <string_view>
9
10USERVER_NAMESPACE_BEGIN
11
12/// Algorithms to aid logging
13namespace utils::log {
14
15/// @brief returns `data` converted to hex and truncated to `limit`
16std::string ToLimitedHex(std::string_view data, size_t limit);
17
18/// @brief if `data` in utf-8, returns `data` truncated to `limit`
19/// otherwise returns stub
20std::string ToLimitedUtf8(std::string_view data, size_t limit);
21
22/// @overload
23/// Does not copy `data` if it is returned as is
24std::string ToLimitedUtf8(std::string&& data, size_t limit);
25
26} // namespace utils::log
27
28USERVER_NAMESPACE_END