3.11.0-rc 3.10.0 (latest) 3.9.0 3.8.0 3.7.0 3.6.0 3.5.0 3.4.0 3.3.0 3.2.0 2.48.0-rc 2.47.1 2.46.0 2.45.0 2.44.0 2.43.0 2.42.0 2.41.0 2.40.0 2.39.0 2.38.0 2.37.0 2.36.0 2.35.0 2.34.0 2.33.0 2.32.0 2.31.0 2.30.0 2.29.0 2.28.0 2.27.0 2.26.0 2.25.1 2.24.0 2.23.0 2.22.1 2.21.0 2.20.0 2.19.0 2.18.0 2.17.0 2.16.0 2.15.1 2.14.0 2.13.0 2.12.0 2.11.0 2.10.1 A sink to receive log records.

## Constructors

### LogSink()

## Functions

### empty() const

Return true if this object has no backends.
We want to avoid synchronization overhead when checking if a log message is enabled. Most of the time, most messages will be disabled, so incurring the locking overhead on each message would be too expensive and would discourage developers from creating logs. Furthermore, missing a few messages while the change of state "propagates" to other threads does not affect the correctness of the program.

Note that `memory_order_relaxed` does not provide a compiler barrier either, so in theory stores into the atomic could be reordered by the optimizer. We have no reason to worry about that because all the writes are done inside a critical section protected by a mutex. The compiler cannot (or should not) reorder operations around those.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### is_enabled(Severity) const

Return true if `severity` is enabled.
We want to avoid synchronization overhead when checking if a log message is enabled. Most of the time, most messages will be disabled, so incurring the locking overhead on each message would be too expensive and would discourage developers from creating logs. Furthermore, missing a few messages while the change of state "propagates" to other threads does not affect the correctness of the program.

Note that `memory_order_relaxed` does not provide a compiler barrier either, so in theory stores into the atomic could be reordered by the optimizer. We have no reason to worry about that because all the writes are done inside a critical section protected by a mutex. The compiler cannot (or should not) reorder operations around those.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `severity` | `Severity` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### set_minimum_severity(Severity)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `minimum` | `Severity` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `void` |   |

### minimum_severity() const

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Severity` |   |

### AddBackend(std::shared_ptr\< LogBackend \>)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `backend` | `std::shared_ptr< LogBackend >` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `BackendId` |   |

### RemoveBackend(BackendId)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `id` | `BackendId` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `void` |   |

### ClearBackends()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `void` |   |

### BackendCount() const

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `std::size_t` |   |

### Log(LogRecord)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `log_record` | `LogRecord` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `void` |   |

### Flush()

Flush all the current backends.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `void` |   |

### static CompileTimeEnabled(Severity)

Return true if the severity is enabled at compile time.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `level` | `Severity` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool constexpr` |   |

### static Instance()

Return the singleton instance for this application.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `LogSink &` |   |

### static EnableStdClog(Severity)

Enable `std::clog` on [`LogSink::Instance()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1LogSink#classgoogle_1_1cloud_1_1LogSink_1a06247b1adf1203876402ba6a9be76a7e).
This is also enabled if the "GOOGLE_CLOUD_CPP_ENABLE_CLOG" environment variable is set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `min_severity` | `Severity` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `void` |   |

### static DisableStdClog()

Disable `std::clog` on [`LogSink::Instance()`](https://docs.cloud.google.com/cpp/docs/reference/common/latest/classgoogle_1_1cloud_1_1LogSink#classgoogle_1_1cloud_1_1LogSink_1a06247b1adf1203876402ba6a9be76a7e).
Note that this will remove the default logging backend.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `void` |   |

## Type Aliases

### BackendId

**Alias Of** : `long`