Tracer
v0.0.1
A platform independant stack trace generator
|
Basic class for all printers. More...
#include <AbstractPrinter.hpp>
Public Member Functions | |
AbstractPrinter () | |
Default constructor. | |
std::string | genStringPreFrame (size_t frameNum) |
Generates a string for the frame information (prefix) More... | |
std::string | genStringForFrame (size_t frameNum) |
Generates a string for the frame information. More... | |
std::string | genStringPostFrame (size_t frameNum) |
Generates a string for the frame information (suffix) More... | |
std::string | generateString () |
Generates a string for the complete stack trace. More... | |
void | printToFile (std::string file, bool append=true) |
Prints the stack trace to a file. More... | |
void | printToStdOut () |
prints the stack trace to STDOUT | |
void | printToStdErr () |
prints the stack trace to STDERR | |
void | enableColor () |
Enables colored output (ANSI escape sequences) | |
void | disableColor () |
Disables colored output (ANSI escape sequences) | |
void | setTrace (Tracer *t) |
Sets the trace to print. More... | |
Protected Member Functions | |
virtual void | setupTrace () |
This function will be called when the trace is sets. | |
virtual std::string | genStringPreFrameIMPL (size_t frameNum) |
Generate string for the frame info prefix. More... | |
virtual std::string | genStringForFrameIMPL (size_t frameNum)=0 |
Generate string for the frame info. | |
virtual std::string | genStringPostFrameIMPL (size_t frameNum) |
Generate string for the frame info suffix. More... | |
Protected Attributes | |
Tracer * | trace = nullptr |
Pointer to the trace. | |
bool | disableColorB = false |
Whether to disable colored output or not. | |
Basic class for all printers.
Definition at line 39 of file AbstractPrinter.hpp.
std::string tracer::AbstractPrinter::generateString | ( | ) |
Generates a string for the complete stack trace.
Definition at line 47 of file AbstractPrinter.cpp.
std::string tracer::AbstractPrinter::genStringForFrame | ( | size_t | frameNum | ) |
Generates a string for the frame information.
frameNum | The number off the frame to process |
Definition at line 88 of file AbstractPrinter.cpp.
std::string tracer::AbstractPrinter::genStringPostFrame | ( | size_t | frameNum | ) |
Generates a string for the frame information (suffix)
frameNum | The number off the frame to process |
Definition at line 100 of file AbstractPrinter.cpp.
|
protectedvirtual |
Generate string for the frame info suffix.
Default implementation.
Reimplemented in tracer::FilePrinter.
Definition at line 69 of file AbstractPrinter.cpp.
std::string tracer::AbstractPrinter::genStringPreFrame | ( | size_t | frameNum | ) |
Generates a string for the frame information (prefix)
frameNum | The number off the frame to process |
Definition at line 76 of file AbstractPrinter.cpp.
|
protectedvirtual |
Generate string for the frame info prefix.
Default implementation.
Reimplemented in tracer::SystemInfoPrinter.
Definition at line 68 of file AbstractPrinter.cpp.
void tracer::AbstractPrinter::printToFile | ( | std::string | file, |
bool | append = true |
||
) |
Prints the stack trace to a file.
file | The file to print to |
append | Whether to append the stack trace to the file or not |
Definition at line 115 of file AbstractPrinter.cpp.
void tracer::AbstractPrinter::setTrace | ( | tracer::Tracer * | t | ) |
Sets the trace to print.
t | The trace to print |
Definition at line 145 of file AbstractPrinter.cpp.