Github   Telegram
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | List of all members
logging::LogHelper Class Referencefinal

#include <userver/logging/log_helper.hpp>

Public Types

enum class  Mode {
  kDefault ,
  kNoSpan
}
 

Public Member Functions

 LogHelper (LoggerPtr logger, Level level, std::string_view path, int line, std::string_view func, Mode mode=Mode::kDefault) noexcept
 Constructs LogHelper with span logging. More...
 
 LogHelper (LogHelper &&)=delete
 
 LogHelper (const LogHelper &)=delete
 
LogHelperoperator= (LogHelper &&)=delete
 
LogHelperoperator= (const LogHelper &)=delete
 
LogHelperAsLvalue () noexcept
 
bool IsLimitReached () const noexcept
 
template<typename T >
LogHelperoperator<< (const T &value)
 
LogHelperoperator<< (char value) noexcept
 
LogHelperoperator<< (std::string_view value) noexcept
 
LogHelperoperator<< (float value) noexcept
 
LogHelperoperator<< (double value) noexcept
 
LogHelperoperator<< (long double value) noexcept
 
LogHelperoperator<< (unsigned long long value) noexcept
 
LogHelperoperator<< (long long value) noexcept
 
LogHelperoperator<< (bool value) noexcept
 
LogHelperoperator<< (const std::exception &value) noexcept
 
LogHelperoperator<< (const LogExtra &extra) noexcept
 Extends internal LogExtra.
 
LogHelperoperator<< (LogExtra &&extra) noexcept
 Extends internal LogExtra.
 
LogHelperoperator<< (Hex hex) noexcept
 
LogHelperoperator<< (HexShort hex) noexcept
 
LogHelperoperator<< (Quoted value) noexcept
 

Detailed Description

Stream-like tskv-formatted log message builder.

Users can add LogHelper& operator<<(LogHelper&, ) overloads to use a faster localeless logging, rather than outputting data through the ostream operator.

Definition at line 69 of file log_helper.hpp.

Member Enumeration Documentation

◆ Mode

enum class logging::LogHelper::Mode
strong

Definition at line 71 of file log_helper.hpp.

Constructor & Destructor Documentation

◆ LogHelper()

logging::LogHelper::LogHelper ( LoggerPtr  logger,
Level  level,
std::string_view  path,
int  line,
std::string_view  func,
Mode  mode = Mode::kDefault 
)
noexcept

Constructs LogHelper with span logging.

Parameters
loggerto log to (logging to nullptr does not output messages)
levelmessage log level
pathpath of the source file that generated the message
lineline of the source file that generated the message
funcname of the function that generated the message
modelogging mode - with or without span

Member Function Documentation

◆ AsLvalue()

LogHelper & logging::LogHelper::AsLvalue ( )
inlinenoexcept

Definition at line 91 of file log_helper.hpp.

◆ operator<<()

template<typename T >
LogHelper & logging::LogHelper::operator<< ( const T &  value)
inline

Definition at line 96 of file log_helper.hpp.


The documentation for this class was generated from the following file: