# Customization

The Persona Chat SDK allows you to extend its functionality by creating custom protocols and loggers.

## Custom Protocols

You can implement your own protocol by extending the `PersonaProtocolBase` class. For example:

```typescript
import { PersonaProtocolBase } from '@applica-software-guru/persona-chat-sdk';

class CustomProtocol extends PersonaProtocolBase {
  // Implement required methods like connect, disconnect, send, etc.
}
```

### Example: Custom Protocol Implementation

Here’s an example of a custom protocol named `CustomProtocol`:

```typescript
import { PersonaProtocolBase } from '@applica-software-guru/persona-chat-sdk';

class CustomProtocol extends PersonaProtocolBase {
  public getName(): string {
    return 'custom';
  }

  public async connect(): Promise<void> {
    console.log('[CustomProtocol] Connecting...');
    this.setStatus('connected');
  }

  public async disconnect(): Promise<void> {
    console.log('[CustomProtocol] Disconnecting...');
    this.setStatus('disconnected');
  }

  public async send(message: string): Promise<void> {
    console.log(`[CustomProtocol] Sending message: ${message}`);
    this.notifyMessage({ role: 'assistant', type: 'text', text: `Echo: ${message}` });
  }
}
```

## Custom Loggers

You can create a custom logger by implementing the `PersonaLogger` interface:

```typescript
import { PersonaLogger } from '@applica-software-guru/persona-chat-sdk';

class CustomLogger implements PersonaLogger {
  log(message: string, ...args: unknown[]): void {
    console.log(`[CustomLogger] ${message}`, ...args);
  }

  info(message: string, ...args: unknown[]): void {
    console.info(`[CustomLogger] ${message}`, ...args);
  }

  warn(message: string, ...args: unknown[]): void {
    console.warn(`[CustomLogger] ${message}`, ...args);
  }

  error(message: string, ...args: unknown[]): void {
    console.error(`[CustomLogger] ${message}`, ...args);
  }

  debug(message: string, ...args: unknown[]): void {
    console.debug(`[CustomLogger] ${message}`, ...args);
  }
}
```
