Skip to content

@logtail/next

Here is an example of the package replacing the logger with the @logtail/next package.

import { log } from "@logtail/next";
// ... omitted
export const trace: Record<LogLevel, Tracer> = {
debug: LOGGER_ENABLED ? log.debug : console.debug,
info: LOGGER_ENABLED ? log.info : console.log,
warn: LOGGER_ENABLED ? log.warn : console.warn,
error: LOGGER_ENABLED ? log.error : console.error,
};

Now when the logger is enabled we’ll use the package log methods instead of the built in console log methods.