Skip to content
Cloudflare Docs

Console

The console object provides a set of methods to help you emit logs, warnings, and debug code.

All standard methods of the console API โ†— are present on the console object in Workers.

However, some methods are no ops โ€” they can be called, and do not emit an error, but do not do anything. This ensures compatibility with libraries which may use these APIs.

The table below enumerates each method, and the extent to which it is supported in Workers.

All methods noted as "โœ… supported" have the following behavior:

All methods noted as "๐ŸŸก partial support" have the following behavior:

  • In both production and local development the method can be safely called, but will do nothing (no op)
  • In the Workers Playground โ†—, Quick Editor in the Workers dashboard, and remote preview mode (wrangler dev --remote) calling the method will behave as expected, print to the console, etc.

Refer to Log from Workers โ†— for more on debugging and adding logs to Workers.

MethodBehavior
console.debug() โ†—โœ… supported
console.error() โ†—โœ… supported
console.info() โ†—โœ… supported
console.log() โ†—โœ… supported
console.warn() โ†—โœ… supported
console.clear() โ†—๐ŸŸก partial support
console.count() โ†—๐ŸŸก partial support
console.group() โ†—๐ŸŸก partial support
console.table() โ†—๐ŸŸก partial support
console.trace() โ†—๐ŸŸก partial support
console.assert() โ†—โšช no op
console.countReset() โ†—โšช no op
console.dir() โ†—โšช no op
console.dirxml() โ†—โšช no op
console.groupCollapsed() โ†—โšช no op
console.groupEnd โ†—โšช no op
console.profile() โ†—โšช no op
console.profileEnd() โ†—โšช no op
console.time() โ†—โšช no op
console.timeEnd() โ†—โšช no op
console.timeLog() โ†—โšช no op
console.timeStamp() โ†—โšช no op
console.createTask() โ†—๐Ÿ”ด Will throw an exception in production, but works in local dev, Quick Editor, and remote preview