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 |
Configure SDK logging levels and integrate custom loggers
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 |
import { initAmplifySDK, LogLevel } from "@paxoslabs/amplify-sdk";
await initAmplifySDK("pxl_your_api_key", {
logLevel: LogLevel.DEBUG,
});
import { setLogLevel, LogLevel } from "@paxoslabs/amplify-sdk";
// Enable debug logs
setLogLevel(LogLevel.DEBUG);
// Disable all logs
setLogLevel(LogLevel.NONE);
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;
}
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),
},
});
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),
},
});
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),
},
});
await initAmplifySDK("pxl_your_api_key", {
logLevel: LogLevel.DEBUG,
telemetry: true,
});
await initAmplifySDK("pxl_your_api_key", {
logLevel: LogLevel.ERROR,
telemetry: true,
logger: yourProductionLogger,
});
import { setLogLevel, LogLevel } from "@paxoslabs/amplify-sdk";
// Enable verbose logging
setLogLevel(LogLevel.DEBUG);
// ... perform problematic operation ...
// Restore normal logging
setLogLevel(LogLevel.ERROR);