addListener method

void addListener(
  1. LoggingListener listener
)

Replaces the current LoggingListener with a custom implementation.

Useful if you want to change the output format, destination, or add logic like filtering or buffering logs.

Example:

console.addListener(MyCustomListener());

Implementation

void addListener(LoggingListener listener) {
  this.listener = listener;
}