quill
Public Member Functions | List of all members
Tags Struct Reference

Macro-Free Logging Interface

More...

#include <LogFunctions.h>

Public Member Functions

 Tags (char const *tag)
 Single tag constructor. More...
 
template<typename... RestTags>
 Tags (char const *first_tag, char const *second_tag, RestTags... rest_tags)
 Constructor for multiple tags. More...
 
QUILL_NODISCARD char const * value () const noexcept
 

Detailed Description

Macro-Free Logging Interface

This file provides an alternative way to log messages without using macros, offering cleaner code in some scenarios at the cost of some performance.

Requirements

The macro-free mode is implemented using __builtin_FILE(), __builtin_FUNCTION(), __builtin_LINE() which may vary by compiler:

Performance Trade-offs

While convenient, the macro-free approach has several performance implications compared to macros:

  1. Higher Latency: Format metadata isn't available at compile time, requiring additional runtime copying of metadata to the backend thread
  2. Always-Evaluated Arguments: Unlike macros which skip evaluation for disabled log levels, arguments to these functions are always evaluated
  3. No Compile-Time Removal: Cannot be completely compiled out with QUILL_COMPILE_ACTIVE_LOG_LEVEL_<LEVEL> as macros can
  4. Backend Thread Impact: Slightly reduced throughput in the backend due to runtime metadata storage and processing

For performance-critical logging paths, use the macro-based logging interface. Tag structure for log messages that supports multiple tags

Constructor & Destructor Documentation

◆ Tags() [1/2]

Tags::Tags ( char const *  tag)
inlineexplicit

Single tag constructor.

Parameters
tagTag to add to the log message

◆ Tags() [2/2]

template<typename... RestTags>
Tags::Tags ( char const *  first_tag,
char const *  second_tag,
RestTags...  rest_tags 
)
inline

Constructor for multiple tags.

Parameters
first_tagTag to add to the log message
second_tagTag to add to the log message
rest_tagsTag to add to the log message

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