# SPORE UI Backend Logging

The SPORE UI backend now includes a configurable logging system to reduce log noise while maintaining important information.

## Log Levels

The logging system supports different levels:

- **INFO**: Important operational messages (default)
- **DEBUG**: Detailed debugging information (only shown when enabled)
- **WARN**: Warning messages
- **ERROR**: Error messages

## Controlling Log Levels

### Environment Variables

Set the `LOG_LEVEL` environment variable to control logging:

```bash
# Show only INFO, WARN, and ERROR messages (default)
LOG_LEVEL=info

# Show all messages including DEBUG
LOG_LEVEL=debug
```

### Development Mode

In development mode (`NODE_ENV=development`), DEBUG messages are automatically enabled:

```bash
NODE_ENV=development npm start
```

## What Was Changed

The following verbose logging has been moved to DEBUG level:

1. **Heartbeat Messages**: Regular heartbeat logs from nodes
2. **WebSocket Broadcasts**: Routine cluster update broadcasts
3. **Proxy Calls**: Individual API proxy request details
4. **Cluster Updates**: Member list change notifications
5. **Discovery Events**: Routine node discovery messages

## Important Messages Still Shown

These messages remain at INFO level for operational visibility:

- Node discovery (new nodes)
- Node status changes (inactive/stale)
- Failover events
- Server startup/shutdown
- Error conditions

## Example Usage

```bash
# Production with minimal logging
LOG_LEVEL=info npm start

# Development with full debugging
LOG_LEVEL=debug npm start

# Or use development mode
NODE_ENV=development npm start
```

This reduces log noise significantly while preserving important operational information.
