# Serilog.Formatting.Compact

**Kind:** Service

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

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

NuGet package dependency

`Serilog.Formatting.Compact` is a NuGet package dependency that formats Serilog log events as compact JSON. `Pams.API` can use its output for structured logs that downstream tools or scripts can parse.

## Diagram

```mermaid
flowchart TD
    Api[Pams.API] --> Logger[Serilog logger]
    Logger --> Formatter[Serilog.Formatting.Compact]
    Formatter --> Output[Compact JSON log output]
    Output --> Consumer[Log consumer]
```

## Usage

```javascript
// Read a compact JSON log event emitted by Pams.API.
const compactLogLine =
  '{"@t":"2024-01-01T00:00:00.0000000Z","@mt":"Request completed","StatusCode":200}';

const logEvent = JSON.parse(compactLogLine);

console.log(logEvent["@t"]);
console.log(logEvent["@mt"]);
console.log(logEvent.StatusCode);
```

## AI Coding Instructions

- Keep `Serilog.Formatting.Compact` configuration in the API logging setup rather than formatting log events manually.
- Preserve compact JSON property names such as `@t` and `@mt` when building log consumers.
- Treat each log line as an independent JSON object when reading file or console output.
- Avoid changing log formatting without checking integrations that parse `Pams.API` log output.

## 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
