# LOG_Builder.LogScope

**Class** · Group: `Logging`

Learn it: [Fast Start - Logging](/fast-start-logging) and [Logging guide](/logging-guide)

<div class="apex-member apex-class">

```apex
global inherited sharing class LOG_Builder.LogScope
```

A logging scope that buffers log entries until closed. On creation, suspends immediate log publishing. On close, flushes all buffered logs and resumes publishing. Provides a simpler alternative to manual suspendSaving/flushBuffer/resumeSaving patterns.

**Example**

```apex
LOG_Builder.LogScope scope = LOG_Builder.scope();
LOG_Builder.build().debug('Step 1').at('BatchJob.execute').emit();
LOG_Builder.build().debug('Step 2').at('BatchJob.execute').emit();
scope.close();
```

</div>

---

## Methods

| Method | Description |
|--------|-------------|
| global void [close](#close)() | Flushes all buffered logs and resumes publishing. |

### close

<div class="apex-member">

```apex
global void close()
```

Flushes all buffered logs and resumes publishing. Safe to call multiple times;
subsequent calls after the first are no-ops.

</div>
