# Common.Logging

**Kind:** Service

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

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

NuGet package dependency

`Common.Logging` is a NuGet package dependency declared by the Pams API project for application logging abstractions. It routes log messages from API code to the logging adapter configured by the host application.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant API as Pams API
    participant Logging as Common.Logging
    participant Sink as Configured Log Sink

    Client->>API: Send API request
    API->>Logging: Write request or error log
    Logging->>Sink: Forward log event
    API-->>Client: Return API response
```

## Usage

```ts
async function loadPamsRecord(recordId: string) {
  const response = await fetch(`/api/pams/records/${recordId}`);

  if (!response.ok) {
    throw new Error(`Pams API request failed: ${response.status}`);
  }

  // The Pams API writes request and error events through Common.Logging.
  return response.json();
}

const record = await loadPamsRecord("record-id");
console.log(record);
```

## AI Coding Instructions

- Keep logging calls inside the Pams API project; client code should call API endpoints rather than reference the NuGet package.
- Use the logging abstraction configured for the application instead of writing directly to a specific logging framework.
- Include request context and exception details when logging API failures.
- Check the API project's package configuration before changing logging adapters or package versions.

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