#include <LogSelector.h>
Each log is logged with a log_id_t, which maps directly to a list of LogSelector objects. Using Log::add(), Log::autoAdd(), or Log::autoAddAll() causes new LogSelector objects to be created and added to the list. Each object describes how to handle matching logs, and includes a file output stream and a set of directives on how to generate the logging header.
The LogSelector's main functionality is to store these preferences and to create the header for being logged. LogSelectors should not be visible outside the code in the Log class.
By using the Log*add methods more than once, multiple LogSelector objects may be created for the same selector string, allowing the log to be printed with different options to different FILE* destinations. Each set of options can only be associated once with a FILE*, multiple invocations with the same FILE* will only override prior ones.
Binary logging ignores the directives on how to print the header fields, as well as what file to output to. The system will only create one binary log.
Definition at line 89 of file LogSelector.h.
Public Member Functions | |
LogSelector (const std::string &name, FILE *fp, LogSelectorTimestamp logTimestamp, LogSelectorName logSelectorName, LogSelectorThreadId logSelectorThreadId, LogSelectorOutput logSelectorOutput) | |
construct a new log selector, passing in options on how to print them | |
std::string | getSelectorHeader () const |
returns a text-readable selector header obeying the user-directives for formatting | |
std::string | getSerializedSelectorHeader () const |
returns a binary selector header which always is in the same format | |
std::string | getName () const |
returns the selector name associated with this object | |
FILE * | getFile () const |
returns the FILE* to print matching logs to | |
LogSelectorTimestamp | getLogTimestamp () const |
returns the timestamp option | |
LogSelectorName | getLogName () const |
returns the log selector name option | |
LogSelectorThreadId | getLogThreadId () const |
returns the log thread id option | |
LogSelectorOutput | getLogSelectorOutput () const |
returns the log selector output option |