In order for a worker to generate log entries when the worker runs, you must use the console output in the worker scripts. For workers sample code, see Workers Code Samples.
The following section provides sample code for a Before Download Worker with debug (console.debug
), info (console.info
), error (console.error
), and warning (console.warn
) information captured for the log. Note that the log should follow the same order - debug
, info
, warn
, and error
.
{ export default async (context: PlatformContext, data: BeforeDownloadRequest): Promise<BeforeDownloadResponse> => { console.debug("This is a debug log line."); console.info("Log something"); console.error("Something is wrong!"); console.warn("It is getting serious!"); return { status: 'DOWNLOAD_PROCEED', message: 'proceed', } }
When the worker is triggered, the Log tab will display all console logs.