# Common.Logging.Core

**Kind:** Service

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

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

NuGet package dependency

`Common.Logging.Core` is a NuGet package dependency declared by the Pams API project. It defines common logging abstractions that the API can use to write log events through a configured logging adapter.

## Diagram

```mermaid
sequenceDiagram
    participant Client
    participant Api as Pams API
    participant Logging as Common.Logging.Core
    participant Adapter as Logging Adapter

    Client->>Api: Send request
    Api->>Logging: Request logger
    Logging->>Adapter: Write log event
    Adapter-->>Logging: Accept event
    Api-->>Client: Return response
```

## Usage

```ts
// Common.Logging.Core runs inside the Pams API process.
// A JavaScript client calls an API endpoint; server-side request handling
// can write logs through the configured Common.Logging adapter.

async function loadPamsRecord(recordId: string) {
  const response = await fetch(`/api/pams/records/${recordId}`, {
    headers: {
      Accept: "application/json",
    },
  });

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

  return response.json();
}

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

## AI Coding Instructions

- Keep `Common.Logging.Core` references in the Pams API project file and resolve logging through its abstraction rather than calling a specific adapter directly.
- Check the configured logging adapter before adding log calls; the core package defines interfaces but does not select an output destination.
- Log request failures and unexpected exceptions with context that does not expose sensitive Pams data.
- Treat this dependency as legacy-format package configuration when editing `Pams.API.csproj`; avoid changing package metadata without checking project restore behavior.

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