rlog: rlog::StdioNode Class Reference

Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | Related Pages

# rlog::StdioNode Class Reference

Logs subscribed messages to a file descriptor. More...

`#include <rlog/StdioNode.h>`

Inheritance diagram for rlog::StdioNode:

List of all members.

## Public Member Functions
| StdioNode (int fdOut=2, bool colorize_if_tty=true)
void | subscribeTo (RLogNode *node)
| StdioNode (int fdOut=2, bool colorize_if_tty=true)
void | subscribeTo (RLogNode *node)
## Protected Member Functions
virtual void | publish (const RLogData &data)
| Publish data.
| StdioNode (const StdioNode &)
StdioNode & | operator= (const StdioNode &)
virtual void | publish (const RLogData &data)
| Publish data.
| StdioNode (const StdioNode &)
StdioNode & | operator= (const StdioNode &)
## Protected Attributes
bool | colorize
int | fdOut

## Detailed Description

Logs subscribed messages to a file descriptor.

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" ));
      }

See also:
  RLogChannel

  RLOG_CHANNEL()

Author:
  Valient Gough

## Constructor & Destructor Documentation

StdioNode::StdioNode | ( | int | _fdOut = `2`,
|  | bool | colorizeIfTTY = `true`
| ) |

  | Parameters:
  | _fdOut | File descriptor to send output
  | colorizeIfTTY | If true (default), then output to a TTY is colorized based on log level (not supported by Win32 console).

## Member Function Documentation

virtual void rlog::StdioNode::publish | ( | const RLogData & | data | ) | `[protected, virtual]`

| Publish data. This iterates over the list of subscribers which have stated interest and sends them the data. Reimplemented from rlog::RLogNode.

void StdioNode::publish | ( | const RLogData & | data | ) | `[protected, virtual]`

| Publish data. This iterates over the list of subscribers which have stated interest and sends them the data. Reimplemented from rlog::RLogNode.

void StdioNode::subscribeTo | ( | RLogNode * | node | ) |

| Subscribe to log messages. Example:
       StdioNode log( STDERR_FILENO );
       // subscribe to error and warning messages
       log.subscribeTo( GetGlobalChannel("error" ));
       log.subscribeTo( RLOG_CHANNEL("warning" ));

The documentation for this class was generated from the following files:

- StdioNode.h
- 1.3.6/rlog/StdioNode.h
- StdioNode.cpp
- 1.3.6/rlog/StdioNode.cpp