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.
The Amplify SDK includes configurable logging to help debug integration issues and monitor SDK behavior in production.
LogLevel
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
import { initAmplifySDK, LogLevel } from '@paxoslabs/amplify-sdk'
await initAmplifySDK('pxl_your_api_key', {
logLevel: LogLevel.DEBUG,
})
At Runtime
import { setLogLevel, LogLevel } from '@paxoslabs/amplify-sdk'
// Enable debug logs
setLogLevel(LogLevel.DEBUG)
// Disable all logs
setLogLevel(LogLevel.NONE)
Custom Logger Interface
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
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
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
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
await initAmplifySDK('pxl_your_api_key', {
logLevel: LogLevel.DEBUG,
telemetry: true,
})
Production
await initAmplifySDK('pxl_your_api_key', {
logLevel: LogLevel.ERROR,
telemetry: true,
logger: yourProductionLogger,
})
Debugging Issues
When troubleshooting, temporarily enable debug logging:
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.