Explore documentation
Logging Typescript with Logtail
If you're using Logtail in a TypeScript codebase, you can take advantage of our types. The custom middleware function from the previous example could look like this:
import { ILogtailLog } from "@logtail/types";
async function enrichLogs(log: ILogtailLog): Promise<ILogtailLog> {
return {
...log,
userId: getCurrentUserId()
};
}