Comctx
Guides

Debug Logging

Inspect Comctx message flow while developing adapters or cross-context integrations.

Use debug when validating an adapter or investigating cross-context flow:

export const [provideCounter, injectCounter] = defineProxy(() => new Counter(), {
  namespace: '__comctx-example__',
  debug: import.meta.env.DEV
})

For focused output, use a debug level:

debug: 'event'

Levels

debug accepts:

debug?: boolean | 'message' | 'event'
  • false disables debug output.
  • true logs both message and event output.
  • message logs adapter-level message flow.
  • event logs effective Comctx events.

Labels

Debug output uses two labels:

  • comctx:message shows messages observed by the adapter. These logs are useful when checking adapter wiring, but they can be noisy because one message can be seen by multiple listeners.
  • comctx:event shows messages accepted by Comctx and routed into send or receive handling.

Examples:

comctx:message provider onMessage apply
comctx:event provider onMessage apply
comctx:event injector sendMessage ping

The second label is the current actor. For sendMessage, it is the side sending the message. For onMessage, it is the side currently receiving or handling the message.

On this page