> ## Documentation Index
> Fetch the complete documentation index at: https://developers.paxoslabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Logging

> Configure SDK logging levels and integrate custom loggers

The Amplify SDK includes configurable logging to help debug integration issues and monitor SDK behavior in production.

## LogLevel

```ts theme={null}
export const LogLevel = {
  DEBUG: 0, // Detailed debugging information
  INFO: 1,  // General operational information
  WARN: 2,  // Warning messages
  ERROR: 3, // Error messages only
  NONE: 4,  // Disable all logging
} as const;

export type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];
```

| Level   | Value | Description                              |
| ------- | ----- | ---------------------------------------- |
| `DEBUG` | 0     | Detailed debugging information (verbose) |
| `INFO`  | 1     | General operational information          |
| `WARN`  | 2     | Warning messages for potential issues    |
| `ERROR` | 3     | Error messages only (default)            |
| `NONE`  | 4     | Disable all logging                      |

## Setting Log Level

### At Initialization

```ts theme={null}
import { initAmplifySDK, LogLevel } from "@paxoslabs/amplify-sdk";

await initAmplifySDK("pxl_your_api_key", {
  logLevel: LogLevel.DEBUG,
});
```

### At Runtime

```ts theme={null}
import { setLogLevel, LogLevel } from "@paxoslabs/amplify-sdk";

// Enable debug logs
setLogLevel(LogLevel.DEBUG);

// Disable all logs
setLogLevel(LogLevel.NONE);
```

## Custom Logger Interface

```ts theme={null}
export interface Logger {
  debug(message: string, context?: Record<string, unknown>): void;
  info(message: string, context?: Record<string, unknown>): void;
  warn(message: string, context?: Record<string, unknown>): void;
  error(message: string, context?: Record<string, unknown>): void;
}
```

## Custom Logger Examples

### Basic Console Logger

```ts theme={null}
import { initAmplifySDK, LogLevel } from "@paxoslabs/amplify-sdk";

await initAmplifySDK("pxl_your_api_key", {
  logLevel: LogLevel.DEBUG,
  logger: {
    debug: (msg, ctx) => console.debug(`[Amplify] ${msg}`, ctx),
    info: (msg, ctx) => console.info(`[Amplify] ${msg}`, ctx),
    warn: (msg, ctx) => console.warn(`[Amplify] ${msg}`, ctx),
    error: (msg, ctx) => console.error(`[Amplify] ${msg}`, ctx),
  },
});
```

### Winston Integration

```ts theme={null}
import winston from "winston";
import { initAmplifySDK, LogLevel } from "@paxoslabs/amplify-sdk";

const winstonLogger = winston.createLogger({
  level: "debug",
  format: winston.format.json(),
  transports: [new winston.transports.Console()],
});

await initAmplifySDK("pxl_your_api_key", {
  logLevel: LogLevel.DEBUG,
  logger: {
    debug: (msg, ctx) => winstonLogger.debug(msg, ctx),
    info: (msg, ctx) => winstonLogger.info(msg, ctx),
    warn: (msg, ctx) => winstonLogger.warn(msg, ctx),
    error: (msg, ctx) => winstonLogger.error(msg, ctx),
  },
});
```

### Pino Integration

```ts theme={null}
import pino from "pino";
import { initAmplifySDK, LogLevel } from "@paxoslabs/amplify-sdk";

const pinoLogger = pino({ level: "debug" });

await initAmplifySDK("pxl_your_api_key", {
  logLevel: LogLevel.DEBUG,
  logger: {
    debug: (msg, ctx) => pinoLogger.debug(ctx, msg),
    info: (msg, ctx) => pinoLogger.info(ctx, msg),
    warn: (msg, ctx) => pinoLogger.warn(ctx, msg),
    error: (msg, ctx) => pinoLogger.error(ctx, msg),
  },
});
```

## Production Recommendations

### Development

```ts theme={null}
await initAmplifySDK("pxl_your_api_key", {
  logLevel: LogLevel.DEBUG,
  telemetry: true,
});
```

### Production

```ts theme={null}
await initAmplifySDK("pxl_your_api_key", {
  logLevel: LogLevel.ERROR,
  telemetry: true,
  logger: yourProductionLogger,
});
```

### Debugging Issues

When troubleshooting, temporarily enable debug logging:

```ts theme={null}
import { setLogLevel, LogLevel } from "@paxoslabs/amplify-sdk";

// Enable verbose logging
setLogLevel(LogLevel.DEBUG);

// ... perform problematic operation ...

// Restore normal logging
setLogLevel(LogLevel.ERROR);
```

For SDK initialization options, see [initAmplifySDK](/v0.4.2/intro/products/earn/developers/api/initAmplifySDK).
