#include <Wt/WLogger>
Public Member Functions | |
| WLogger () | |
| Create a new logger. | |
| ~WLogger () | |
| Destructor. | |
| void | setStream (std::ostream &o) |
| Set the output stream. | |
| void | setFile (const std::string &path) |
| Set the output file. | |
| void | addField (const std::string &name, bool isString) |
| Add a field. | |
| const std::vector< Field > & | fields () const |
| Returns the field list. | |
| WLogEntry | entry () const |
| Start a new log entry. | |
Static Public Attributes | |
| static const Sep | sep = WLogger::Sep() |
| Field separator constant. | |
| static const TimeStamp | timestamp = WLogger::TimeStamp() |
| Timestamp field constant. | |
Classes | |
| class | Field |
| Class that holds the configuration for a single field. More... | |
| struct | Sep |
| Class that indicates a field separator. More... | |
| struct | TimeStamp |
| Class that indicates a time stamp. More... | |
This class logs events to a stream in a flexible way. It allows to create log files using the commonly used Common Log Format or Combined Log Format, but provides a general way for logging entries that consists of a fixed number of fields.
It is used by Wt to create the application log (WApplication::log()), and built-in httpd access log.
To use this class to create your own log files, you should instantiate a logger, add one or more field definitions using addField(), and set an output stream using setStream() or setFile(). To stream data to the logger, use entry() to start formatting a new entry.
| void Wt::WLogger::setStream | ( | std::ostream & | o | ) |
| void Wt::WLogger::setFile | ( | const std::string & | path | ) |
const WLogger::Sep Wt::WLogger::sep = WLogger::Sep() [static] |
const WLogger::TimeStamp Wt::WLogger::timestamp = WLogger::TimeStamp() [static] |
1.5.6