This service allows you to avoid to quickly build simple logging, observability or analytics using the logging interface. Logging will work on any JavaScript backend, in Serverless and Edge functions as well as in the browser or mobile application.
Server or Client
import { log } from 'iltio' await log('My log message!', regularLogId) await log(`Load page: ${page}`, trackPageLoadLogId) await log(error.getMessage(), unexpectedErrorLogId) const error: boolean = await log('Success?', regularLogId)
Serverless or Edge Functions
import { log } from 'iltio' export function GET(request: Request) { const { error } = await log('Message', 123) return new Response(error ? 'Error' : 'Success') } export function GET(request: Request, { waitUntil }) { waitUntil(log('Message', 123)) return new Response('Response sent before log') }
Logging will require an additional request. If you want to send the response as quickly as possible and still make sure the logging request is sent use waitUntil
to ensure the function won't timeout before the request was sent.