# rlog::RLogChannel Class Reference

Implements a hierarchical logging channel. More...

`#include <rlog/RLogChannel.h>`

Inheritance diagram for rlog::RLogChannel:

List of all members.

## Public Member Functions

| RLogChannel (const std::string &name, LogLevel level)
virtual void | publish (const RLogData &data)
| Publish data.
const std::string & | name () const
LogLevel | logLevel () const
void | setLogLevel (LogLevel level)

## Protected Member Functions

RLogChannel * | getComponent (RLogChannel *componentParent, const char *component)

## Friends

RLogChannel * | GetComponentChannel (const char *component, const char *path, LogLevel level)
| Return the named channel for a particular component.

## Related Functions

(Note that these are not member functions.)
RLogChannel * | GetGlobalChannel (const char *path, LogLevel level)
| Return the named channel across all components.

## Detailed Description

Implements a hierarchical logging channel.

You should not need to use RLogChannel directly under normal circumstances. See RLOG_CHANNEL() macro, GetComponentChannel() and GetGlobalChannel()

RLogChannel implements channel logging support. A channel is a named logging location which is global to the program. Channels are hierarchically related.

For example, if somewhere in your program a message is logged to "debug/foo/bar", then it will be delived to any subscribers to "debug/foo/bar", or subscribers to "debug/foo", or subscribers to "debug". Subscribing to a channel means you will receive anything published on that channel or sub-channels.

As a special case, subscribing to the channel "" means you will receive all messages - as every message has a channel and the empty string "" is considered to mean the root of the channel tree.

In addition, componentized channels are all considered sub channels of the global channel hierarchy. All rDebug(), rWarning(), and rError() macros publish to the componentized channels (component defined by RLOG_COMPONENT).

          // get the "debug" channel for our component.  This is the same as
          // what rDebug() publishes to.
          RLogChannel *node = RLOG_CHANNEL( "debug", Log_Debug );
          // equivalent to
          RLogChannel *node = GetComponentChannel( RLOG_COMPONENT, "debug" );

          // Or, get the global "debug" channel, which will have messages from
          // *all* component's "debug" channels.
          RLogChannel *node = GetGlobalChannel( "debug", Log_Debug );

Author:
  Valient Gough

See also:
  RLOG_CHANNEL()

  GetComponentChannel()

  GetGlobalChannel()

## Member Function Documentation

void RLogChannel::publish | ( | const RLogData & | data | ) | `[virtual]`

Publish data.

This iterates over the list of subscribers which have stated interest and sends them the data.

Reimplemented from rlog::RLogNode.

## Friends And Related Function Documentation

RLogChannel * GetComponentChannel | ( | const char * | component,
|  | const char * | path,
|  | LogLevel | level = `Log_Undef` |
| ) |  |  | `[friend]`

Return the named channel for a particular component.

Author:
  Valient Gough

RLogChannel * GetGlobalChannel | ( | const char * | path,
|  | LogLevel | level |
| ) |  |  | `[related]`

Return the named channel across all components.

Channels are hierarchical. See RLogChannel for more detail. The global channel contains messages for all component channels.

For example, subscribing to the global "debug" means the subscriber would also get messages from <Component , "debug">, and <Component-B, "debug">, and <Component-C, "debug/foo">, etc.

Author:
  Valient Gough

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

- RLogChannel.h
- RLogChannel.cpp