Serenity Logger
A very fast and effiecient logging library. This library currently can log to files, rotate files when logging, log to the terminal, and is aware if the terminal is being piped during logging.
serenity::msg_details::Message_Formatter Class Reference

Controls how the prepended string of text before the actual log message will be displayed and how each flag/argument is formatted.

Classes

struct  Formatter
 Virtual Base Struct that all formatter structs inherit from and implement. More...
 
class  Formatters
 This class is the top-level formatting class that holds and controls each flag arguments specific formatting abilities. More...
 

Public Member Functions

 Message_Formatter (std::string_view pattern, Message_Info *details)
 Constructor that takes in a format pattern paramater and a Message_Info class pointer. More...
 
 Message_Formatter (const Message_Formatter &)=delete
 
Message_Formatteroperator= (const Message_Info &)=delete
 
void FlagFormatter (size_t flag)
 Intializes and stores the Formatter struct at the index provided into the Formatters container.
 
void SetPattern (std::string_view pattern)
 Sets the format pattern variable and then parses the format string to store each flag as its own individual Formmater struct that will be in charge of how each flag is formatted.
 
FormattersGetFormatters ()
 Returns the Message_Formatter's instance of the Formatters container which holds the individual Formatter pointers. Can be called to manually call the Format() function for all arguments stored.
 
void StoreFormat ()
 Store the format pattern internally to be used more efficiently when formatting log messages. More...
 
Message_InfoMessageDetails ()
 Returns a pointer to the Message_Info instance used by Message_Formatter.
 

Constructor & Destructor Documentation

◆ Message_Formatter()

serenity::msg_details::Message_Formatter::Message_Formatter ( std::string_view  pattern,
Message_Info details 
)
explicit

The format pattern is set and internally stored by its individual flag arguments to iterate over when a message is logged. The Message_Info class is used to populate the arguments or references when storing and using the individual flag components

Member Function Documentation

◆ StoreFormat()

void serenity::msg_details::Message_Formatter::StoreFormat ( )

SetPattern() calls this function internally. Parses the internal format pattern string stored from SetPattern() or from a constructor that took in a format pattern argument and for each flag found by the delimiter "%", will try to match the potential flag to the index of the valid flags array. If a match is found, initializes and stores the respective Formatter struct for that flag, otherwise, stores this value as well as any other char, by passing in the value to initialize and store a Format_Arg_Char struct instead


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