Simple-Log
alpha-v0.7
|
Helper class for building new Records. More...
#include <RecordBuilder.hpp>
Public Types | |
using | Record_t = std::remove_cvref_t< TRecord > |
using | SeverityLevel_t = RecordSeverity_t< Record_t > |
using | Channel_t = RecordChannel_t< Record_t > |
Public Member Functions | |
RecordBuilder (Record_t prefabRec, LogCallback_t cb) noexcept | |
Constructor. More... | |
~RecordBuilder () noexcept | |
Destructor. More... | |
RecordBuilder (RecordBuilder &&other) noexcept | |
Move constructor. More... | |
RecordBuilder & | operator= (RecordBuilder &&other) noexcept |
Move-assign operator. More... | |
RecordBuilder (const RecordBuilder &)=delete | |
Deleted copy constructor. More... | |
RecordBuilder & | operator= (const RecordBuilder &)=delete |
Deleted copy-assign operator. More... | |
Record_t & | record () noexcept |
Accessor to the internal record object. More... | |
const Record_t & | record () const noexcept |
Const accessor to the internal record object. More... | |
template<class T > | |
requires | requires (T &&data) |
Output operator. More... | |
RecordBuilder & | operator<< (T &&data) |
template<std::invocable< Record_t & > TAction> | |
RecordBuilder & | operator<< (TAction action) |
Special output operator overload for actions on Record. More... | |
Helper class for building new Records.
TRecord | Used Record type. |
This is class provides the simple and elegant interface for making logging expressions. Its objects are non-copyable but movable. When a RecordBuilder object gets destroyed (mainly because going out of scope) it will automatically send its created Record to the designated Logger object. Users should not instantiate objects themselves, but should instead use the Logger objects.
using sl::log::RecordBuilder< TRecord >::Channel_t = RecordChannel_t<Record_t> |
using sl::log::RecordBuilder< TRecord >::Record_t = std::remove_cvref_t<TRecord> |
using sl::log::RecordBuilder< TRecord >::SeverityLevel_t = RecordSeverity_t<Record_t> |
|
inlineexplicitnoexcept |
Constructor.
prefabRec | Prefabricated Record |
cb | Callback to the associated Logger object |
This constructor requires a callback to the associated Logger objects log function. The callback should have the following signature:
|
inlinenoexcept |
Destructor.
If RecordBuilder is valid (in fact, if a callback is installed) it moves its created Record object to the Logger object.
|
inlinenoexcept |
Move constructor.
Transfers ownership of other's data to this object. If other has an installed callback, it will be cleared.
other | Another RecordBuilder object |
|
delete |
Deleted copy constructor.
|
inline |
|
inline |
Special output operator overload for actions on Record.
action | Action which will be applied to the internal Record object. |
|
delete |
Deleted copy-assign operator.
|
inlinenoexcept |
Move-assign operator.
Transfers ownership of other's data to this object. If other has an installed callback, it will be cleared.
other | Another RecordBuilder object |
|
inlinenoexcept |
Const accessor to the internal record object.
|
inlinenoexcept |
Accessor to the internal record object.
|
inline |
Output operator.
Attaches data to the underlying ostream object.
T | Requires that std::ostringstream has an overload of operator << for T. |
data | Data about to be attached. |