Safir SDK Core
|
A class for trace logging. More...
#include <Safir/Application/Tracer.h>
Public Types | |
typedef std::basic_ostream < wchar_t, std::char_traits < wchar_t > > | stream_type |
Public Member Functions | |
Tracer (const std::wstring &prefix) | |
Constructor. More... | |
~Tracer () | |
Destructor. More... | |
void | Enable (const bool enabled) |
Turn logging of this prefix on or off. More... | |
bool | IsEnabled () const |
Check whether this prefix is enabled or not. More... | |
const Tracer & | operator<< (stream_type &(*_Pfn)(stream_type &)) const |
Output operator for io manipulators. More... | |
const Tracer & | operator<< (std::ios_base &(*_Pfn)(std::ios_base &)) const |
Output operator for io manipulators. More... | |
const Tracer & | operator<< (ios_type &(*_Pfn)(ios_type &)) const |
Output operator for io manipulators. More... | |
template<class T > | |
const Tracer & | operator<< (const T &data) const |
Output operator for data. More... | |
stream_type & | stream () const |
Get the underlying ostream of the logger. More... | |
A class for trace logging.
typedef std::basic_ostream<wchar_t, std::char_traits<wchar_t> > Safir::Application::Tracer::stream_type |
|
explicit |
Constructor.
Create a logger with a certain prefix.
prefix | [in] The prefix for this logger. |
Safir::Application::Tracer::~Tracer | ( | ) |
Destructor.
void Safir::Application::Tracer::Enable | ( | const bool | enabled | ) |
Turn logging of this prefix on or off.
enabled | [in] The state to set logging to. |
bool Safir::Application::Tracer::IsEnabled | ( | ) | const |
Check whether this prefix is enabled or not.
const Tracer& Safir::Application::Tracer::operator<< | ( | stream_type &(*)(stream_type &) | _Pfn | ) | const |
Output operator for io manipulators.
Checks whether the prefix is enabled before executing the function.
const Tracer& Safir::Application::Tracer::operator<< | ( | std::ios_base &(*)(std::ios_base &) | _Pfn | ) | const |
Output operator for io manipulators.
Checks whether the prefix is enabled before executing the function.
const Tracer& Safir::Application::Tracer::operator<< | ( | ios_type &(*)(ios_type &) | _Pfn | ) | const |
Output operator for io manipulators.
Checks whether the prefix is enabled before executing the function.
const Tracer& Safir::Application::Tracer::operator<< | ( | const T & | data | ) | const |
Output operator for data.
Checks whether the prefix is enabled before performing the output.
stream_type& Safir::Application::Tracer::stream | ( | ) | const |
Get the underlying ostream of the logger.
Since the tracer is not an ostream itself it is sometimes desirable to get the underlying ostream to be able to pass to existing functions that take ostreams as argument. Note however that the checks for whether the prefix is enabled are not performed within this stream! So to use this reliably you need to surround the use of the stream with checks to see if the prefix is enabled or not.