# Diagnostics

Log entries, capacity, and subscriptions.

[Read the diagnostics guide](/docs/diagnostics/). Signatures below come from the published SDK declarations. Access SDK services through `db`; use their constructors only when integrating at a lower level.

## DiagnosticType


```ts
type DiagnosticType =
  "request" | "publish" | "ingest" | "error" | "connection" | "sync" | "queue";
```

## DiagnosticEntry


```ts
interface DiagnosticEntry {
  sequence: number;
  timestamp: number;
  type: DiagnosticType;
  operation: string;
  details: Readonly<Record<string, string | number | boolean | null>>;
}
```

## DiagnosticsOptions


```ts
interface DiagnosticsOptions {
  enabled?: boolean;
  capacity?: number;
  onEntry?: (entry: DiagnosticEntry) => void;
}
```

## NostrbaseDiagnostics


```ts
/** Content, keys, signer objects, headers, and payloads are never included in SDK diagnostics. */
declare class NostrbaseDiagnostics {}
```

### Properties


```ts
readonly events$: Observable<DiagnosticEntry>;
```

### constructor


```ts
constructor(options?: DiagnosticsOptions);
```

### record


```ts
record(
  type: DiagnosticType,
  operation: string,
  details?: Record<string, string | number | boolean | null>,
): void;
```

### list


```ts
list(): DiagnosticEntry[];
```

### clear


```ts
clear(): void;
```

### close


```ts
close(): void;
```
