import { z } from 'zod'; export enum LogLevel { AUDIT = 'AUDIT', INFO = 'INFO', WARNING = 'WARNING', ERROR = 'ERROR', } export const LogPayloadSchema = z.object({ message: z.string(), meta: z.object({ // Properties are nested under "meta" so the DXP log level does not conflict with the winston log level. // Job runner specific attributes. tenant: z.string(), jobName: z.string(), // Logging service attributes. level: z.enum(LogLevel), timestamp: z.iso.datetime(), traceid: z.string(), tags: z.array(z.string()).optional(), details: z.record(z.string(), z.unknown()).optional(), }), }); export type LogPayload = z.infer; export const CONSOLE_LOG_METHOD_LEVELS: Partial> = { log: LogLevel.INFO, info: LogLevel.INFO, warn: LogLevel.WARNING, error: LogLevel.ERROR, };