log method

void log(
  1. Level logLevel,
  2. Object? message,
  3. dynamic error,
  4. StackTrace? stackTrace,
)

Adds a log record for a message at a particular logLevel if isLoggable(logLevel) is true.

Use this method to create log entries for user-defined levels. To record a message at a predefined level (e.g. Level.INFO, Level.WARNING, etc) you can use their specialized methods instead (e.g. info, warning, etc).

If message is a Function, it will be lazy evaluated. Additionally, if message or its evaluated value is not a String, then 'toString()' will be called on the object and the result will be logged. The log record will contain a field holding the original object.

The log record will also contain a field for the zone in which this call was made. This can be advantageous if a log listener wants to handler records of different zones differently (e.g. group log records by HTTP request if each HTTP request handler runs in it's own zone).

Implementation

void log(
  Level logLevel,
  Object? message,
  dynamic error,
  StackTrace? stackTrace,
) {
  return logger.log(logLevel, message, error, stackTrace);
}