Hypertune
Search
K
Comment on page

Custom logging

By default, SDKs output info and error logs to the console. But you can provide a custom logging callback to capture and forward logs elsewhere, e.g. to your monitoring infrastructure.
Pass the logger option in the call to initializeHypertune:
import { initializeHypertune } from "./generated/generated";
const hypertune = initializeHypertune({}, {
token: process.env.NEXT_PUBLIC_HYPERTUNE_TOKEN,
logger: (level, message, metadata) => {
console.log(level, message, metadata);
}
});
export default hypertune;

logger?: (
level: LogLevel,
message: string,
metadata: Record<string, unknown>
) => void;
enum LogLevel {
Debug = 'Debug',
Error = 'Error',
Info = 'Info',
Warn = 'Warn'
}