# ConsoleChannel

<a id="consolechannel"></a>

# ConsoleChannel

```cpp
#include <icy/logger.h>

class ConsoleChannel
```

[Defined in src/base/include/icy/logger.h:456](https://github.com/auscaster/icey/blob/main/src/base/include/icy/logger.h#L456)

> **Inherits:** [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel)

Log channel that writes formatted messages to standard output.

## List of all members

| Name | Kind | Owner |
|------|------|-------|
| [`ConsoleChannel`](#consolechannel-1) | `function` | Declared here |
| [`~ConsoleChannel`](#consolechannel-2) | `function` | Declared here |
| [`write`](#write-1) | `function` | Declared here |
| [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel-1) | `function` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`~LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel-2) | `function` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`write`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#write-5) | `function` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`write`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#write-6) | `function` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`format`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#format-4) | `function` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`name`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#name-1) | `function` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`level`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#level-1) | `function` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`timeFormat`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#timeformat) | `function` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`setLevel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#setlevel) | `function` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`setTimeFormat`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#settimeformat) | `function` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`setFilter`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#setfilter) | `function` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`_name`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#_name) | `variable` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`_level`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#_level) | `variable` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`_timeFormat`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#_timeformat) | `variable` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |
| [`_filter`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#_filter) | `variable` | Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel) |

## Inherited from [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel)

| Kind | Name | Description |
|------|------|-------------|
| `function` | [`LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel-1)  |  |
| `function` | [`~LogChannel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#logchannel-2) `virtual` | Defaulted destructor. |
| `function` | [`write`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#write-5) `virtual` | Writes a log stream entry to this channel. |
| `function` | [`write`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#write-6) `virtual` | Writes a plain message to this channel. |
| `function` | [`format`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#format-4) `virtual` | Formats a log stream entry into the given output stream. |
| `function` | [`name`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#name-1) `const` `inline` | Returns the channel name. |
| `function` | [`level`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#level-1) `const` `inline` | Returns the minimum severity level. |
| `function` | [`timeFormat`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#timeformat) `const` `inline` | Returns the timestamp format string. |
| `function` | [`setLevel`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#setlevel) `inline` | Sets the minimum severity level. |
| `function` | [`setTimeFormat`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#settimeformat) `inline` | Sets the timestamp format string. |
| `function` | [`setFilter`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#setfilter) `inline` | Sets a realm filter; only messages whose realm matches are written. |
| `variable` | [`_name`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#_name)  |  |
| `variable` | [`_level`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#_level)  |  |
| `variable` | [`_timeFormat`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#_timeformat)  |  |
| `variable` | [`_filter`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#_filter)  |  |

## Public Methods

| Return | Name | Description |
|--------|------|-------------|
|  | [`ConsoleChannel`](#consolechannel-1)  |  |
|  | [`~ConsoleChannel`](#consolechannel-2) `virtual` | Defaulted destructor. |
| `void` | [`write`](#write-1) `virtual` `override` | Formats and writes the log stream entry to stdout. Messages below the channel level or filtered by realm are silently dropped. |

---

<a id="consolechannel-1"></a>

### ConsoleChannel

```cpp
ConsoleChannel(std::string name, Level level = Level::Debug, std::string timeFormat = "%H:%M:%S")
```

[Defined in src/base/include/icy/logger.h:462](https://github.com/auscaster/icey/blob/main/src/base/include/icy/logger.h#L462)

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `name` | `std::string` | Unique channel name. |
| `level` | [`Level`](https://auscaster.com/icey/docs/api-reference/base.md#level) | Minimum severity level; messages below this level are dropped. |
| `timeFormat` | `std::string` | strftime-compatible format string for timestamps. |

---

<a id="consolechannel-2"></a>

### ~ConsoleChannel

`virtual`

```cpp
virtual ~ConsoleChannel() = default
```

[Defined in src/base/include/icy/logger.h:464](https://github.com/auscaster/icey/blob/main/src/base/include/icy/logger.h#L464)

Defaulted destructor.

---

<a id="write-1"></a>

### write

`virtual` `override`

```cpp
virtual void write(const LogStream & stream) override
```

[Defined in src/base/include/icy/logger.h:469](https://github.com/auscaster/icey/blob/main/src/base/include/icy/logger.h#L469)

Formats and writes the log stream entry to stdout. Messages below the channel level or filtered by realm are silently dropped.

#### Reimplements

- [`LogChannel::write`](https://auscaster.com/icey/docs/api-reference/icy-LogChannel.md#write-5)

#### Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `stream` | const [`LogStream`](https://auscaster.com/icey/docs/api-reference/icy-LogStream.md#logstream) & | The log stream to write. |
