<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "BitcoinKernel",
  "identifier" : "/documentation/BitcoinKernel/LoggingConnection",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "BitcoinKernel"
    ],
    "preciseIdentifier" : "s:13BitcoinKernel17LoggingConnectionC"
  },
  "title" : "LoggingConnection"
}
-->

# LoggingConnection

A connection to the kernel’s internal logging system.

```
final class LoggingConnection
```

## Overview

### Opt-in by construction

Kernel logging is dormant until you explicitly create a
[`LoggingConnection`](/documentation/BitcoinKernel/LoggingConnection): there is no default, always-on destination. An
application that does not want kernel log output simply never instantiates
one — no build flag required. This replaces the `DISABLE_KERNEL_LOGGING`
build-flag pattern some downstream projects have used; the equivalent
opt-out here is just to skip construction.

For belt-and-suspenders silence (skip the internal logger entirely),
call [`disableLogging()`](/documentation/BitcoinKernel/disableLogging()) once at program startup before any connection
is created. After [`disableLogging()`](/documentation/BitcoinKernel/disableLogging()) has been called, no further
connections can be created and kernel log writes become no-ops.

### Buffering

Messages logged before a connection is created are buffered (up to 1 MB)
and delivered immediately when the first connection is established.

Wraps the opaque `btck_LoggingConnection` type. ARC via `deinit` calls
`btck_logging_connection_destroy` when the last reference drops.