# Serilog.Sinks.PeriodicBatching

**Kind:** Service

**Source:** `Pams/API/Pams.API/Pams.API.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

`Pams.API` references `Serilog.Sinks.PeriodicBatching` as a NuGet package dependency. The package supports Serilog sinks that collect log events and emit them on a periodic batch schedule before sending them to a configured destination.

## Diagram

```mermaid
sequenceDiagram
    participant App as Pams.API
    participant Serilog as Serilog Logger
    participant Batch as Periodic Batching Sink
    participant Target as Configured Sink

    App->>Serilog: Write log event
    Serilog->>Batch: Queue event
    Batch->>Target: Emit queued event batch
```

## Usage

```javascript
import { spawnSync } from "node:child_process";

const result = spawnSync(
  "dotnet",
  [
    "add",
    "Pams/API/Pams.API/Pams.API.csproj",
    "package",
    "Serilog.Sinks.PeriodicBatching",
  ],
  { stdio: "inherit" },
);

if (result.status !== 0) {
  throw new Error("Failed to add Serilog.Sinks.PeriodicBatching.");
}
```

## AI Coding Instructions

- Keep the package reference associated with `Pams.API` in `Pams.API.csproj`.
- Check whether the project uses `PackageReference` or a legacy NuGet package format before editing dependency declarations.
- Configure batching through the Serilog sink that depends on this package, rather than calling this package directly from application code.
- Confirm that the target Serilog sink supports periodic batching before adding batching settings.

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (1)

- `Pams.API` — `Pams/API/Pams.API/Pams.API.csproj`:1
