Pigweed
 
Loading...
Searching...
No Matches
pw::log_tokenized::GenericMetadata< kLevelBits, kLineBits, kFlagBits, kModuleBits, T > Class Template Reference

#include <metadata.h>

Public Member Functions

constexpr GenericMetadata (T log_level, T module, T flags, T line)
 
constexpr GenericMetadata (T value)
 
constexpr T level () const
 The log level of this message.
 
constexpr T line_number () const
 
constexpr T flags () const
 The flags provided to the log call.
 
constexpr T module () const
 
constexpr T value () const
 The underlying packed metadata.
 

Static Public Member Functions

template<T log_level = 0, T module = 0, T flags = 0, T line = 0>
static constexpr GenericMetadata Set ()
 

Detailed Description

template<unsigned kLevelBits, unsigned kLineBits, unsigned kFlagBits, unsigned kModuleBits, typename T = uintptr_t>
class pw::log_tokenized::GenericMetadata< kLevelBits, kLineBits, kFlagBits, kModuleBits, T >

GenericMetadata facilitates the creation and interpretation of packed log metadata payloads. The GenericMetadata class allows flags, log level, line number, and a module identifier to be packed into bit fields of configurable size.

Typically, the Metadata alias should be used instead.

Constructor & Destructor Documentation

◆ GenericMetadata()

template<unsigned kLevelBits, unsigned kLineBits, unsigned kFlagBits, unsigned kModuleBits, typename T = uintptr_t>
constexpr pw::log_tokenized::GenericMetadata< kLevelBits, kLineBits, kFlagBits, kModuleBits, T >::GenericMetadata ( log_level,
module,
flags,
line 
)
inlineconstexpr

Only use this constructor for creating metadata from runtime values. This constructor is unable to warn at compilation when values will not fit in the specified bit field widths.

Member Function Documentation

◆ line_number()

template<unsigned kLevelBits, unsigned kLineBits, unsigned kFlagBits, unsigned kModuleBits, typename T = uintptr_t>
constexpr T pw::log_tokenized::GenericMetadata< kLevelBits, kLineBits, kFlagBits, kModuleBits, T >::line_number ( ) const
inlineconstexpr

The line number of the log call. The first line in a file is 1. If the line number is 0, it was too large to be stored.

◆ module()

template<unsigned kLevelBits, unsigned kLineBits, unsigned kFlagBits, unsigned kModuleBits, typename T = uintptr_t>
constexpr T pw::log_tokenized::GenericMetadata< kLevelBits, kLineBits, kFlagBits, kModuleBits, T >::module ( ) const
inlineconstexpr

The 16-bit tokenized version of the module name (

embed:rst:inline :c:macro:`PW_LOG_MODULE_NAME` 

).


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