#include <rlog/StdioNode.h>
Inheritance diagram for rlog::StdioNode:
Public Types | |
enum | StdioFlags { DefaultOutput = 0, OutputColor = 1, OutputThreadId = 2, OutputContext = 4, OutputChannel = 8 } |
Public Member Functions | |
StdioNode (int fdOut=2, int flags=(int) DefaultOutput) | |
StdioNode (int fdOut, bool colorize_if_tty) | |
void | subscribeTo (RLogNode *node) |
Protected Member Functions | |
virtual void | publish (const RLogData &data) |
Publish data. | |
StdioNode (const StdioNode &) | |
StdioNode & | operator= (const StdioNode &) |
Protected Attributes | |
bool | colorize |
bool | outputThreadId |
bool | outputContext |
bool | outputChannel |
int | fdOut |
This displays all subscribed messages to a file descriptor. If the output is a terminal, then the messages are colorized (yellow for warnings, red for errors).
For example, to log to stderr:
int main(int argc, char **argv) { // tell RLog the program name.. RLog_Init( argv[0] ); // log to standard error StdioNode stdlog( STDERR_FILENO ); // show all warning and error messages, no matter what component they // come from. stdlog.subscribeTo( GetGlobalChannel( "warning" )); stdlog.subscribeTo( GetGlobalChannel( "error" )); }
RLOG_CHANNEL()
|
|
|
Publish data. This iterates over the list of subscribers which have stated interest and sends them the data. Reimplemented from rlog::RLogNode. |
|
Subscribe to log messages. Example: StdioNode log( STDERR_FILENO ); // subscribe to error and warning messages log.subscribeTo( GetGlobalChannel("error" )); log.subscribeTo( RLOG_CHANNEL("warning" )); |