Release Notes
Security Announcement
Announcements
console object to output debugging information and logs. The output content can be viewed and analyzed through web debugging operations, or the real-time log push feature can be used to achieve long-term log retention and query analysis.console.log(val1)console.log(val1, /* …, */ valN)
console object's other methods (info(), notice(), warn(), error(), debug()) have the same syntax format.Parameter Name | Type | Required | Description |
val1 | string | number | null | undefined | boolean | object | Symbol | Array<[string, string]> | Function | No | The first value to output. |
valN | string | number | null | undefined | boolean | object | Symbol | Array<[string, string]> | Function | No | Other values to output. |
console can be retained and analyzed through the real-time log push feature for long-term log retention and query analysis.console supports four levels: info, notice, warn, and error. console.log() corresponds to the info level.console output content size limit is 4KB. Exceeding the limit will result in truncation.console content length to 8k characters.console outputs per request. Any console output exceeding 20 will not be shown on the debugging page.function handleEvent(event) {const { request } = event;const url = new URL(request.url);// Output basic informationconsole.log('Process request:', url.pathname);// Output prompt messageconsole.info('Request processing started');// Output attention informationconsole.notice('Request processing method:', request.method);// Output warning informationconsole.warn('Request parameters may be incomplete');// Output error informationconsole.error('Error occurred while processing the request');return event.respondWith(new Response('Hello World'));}addEventListener('fetch', event => {handleEvent(event);});

Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback