# LoggerUtilities

`class` in `logger` · v0.3.2

<https://docs.seedcord.org/packages/logger/0.3.2/logger-utilities>

Logging helpers for lists, summaries, registration lines, and blocks.

```ts
class LoggerUtilities
```

## Constructors

### constructor

```ts
LoggerUtilities(logger: ILogger)
```

Constructs a new instance of the `LoggerUtilities` class

## Methods

### block

```ts
public block(
    heading: string,
    lines: readonly string[],
    level?: LogLevel,
    styleHeading?: (heading: string) => string
): void
```

Logs a heading and its lines as one record so the TUI renders them as a single block. `styleHeading` replaces the default mint bold, pass an identity function for a heading that styles its own spans.

### counts

```ts
public counts(
    record: Record<string, number>,
    maxWidth?: number
): string[]
```

Formats non-zero counts into `N label` chips, wrapped onto lines under `maxWidth`.

### entries

```ts
public entries(
    items: readonly { name: string; from: string }[]
): string[]
```

Formats `name path` block lines, names padded to a column and paths relative and dimmed.

### initialization

```ts
public initialization(
    component: string,
    action: "start" | "end",
    level?: LogLevel
): void
```

Logs component initialization start or end.

### item

```ts
public item(
    text: string,
    level?: LogLevel
): void
```

Logs a single item with an arrow prefix.

### list

```ts
public list(
    items: string[],
    heading?: string,
    level?: LogLevel
): void
```

Logs a list of items with an optional heading above them.

### progress

```ts
public progress(
    current: number,
    total: number,
    item?: string,
    level?: LogLevel
): void
```

Logs progress as "[current/total]" with an optional item label.

### registration

```ts
public registration(
    name: string,
    from: string,
    type?: string,
    level?: LogLevel
): void
```

Logs a component registration line, with an optional type label like 'middleware' or 'handler'.

### summary

```ts
public summary(
    title: string,
    items: Record<
        string,
        number | string
    >,
    level?: LogLevel
): void
```

Logs a title with key-value counts, e.g. "Loaded: 5 handlers, 3 commands".

### wrap

```ts
public wrap(
    labels: readonly string[],
    maxWidth?: number
): string[]
```

Packs labels into `·`-separated lines under `maxWidth`, each styled.
