wrapLogger static method

DeprecationProcessingLogger wrapLogger(
  1. Logger? logger,
  2. Iterable<Deprecation>? silenceDeprecations,
  3. Iterable<Deprecation>? fatalDeprecations,
  4. Iterable<Deprecation>? futureDeprecations, {
  5. bool color = false,
})

Wraps logger to process deprecations within an ImportCache.

This wrapped logger will handle the deprecation options, but will not limit repetition, as it can be re-used across parses. A logger passed to an ImportCache or AsyncImportCache should generally be wrapped here first, unless it's already been wrapped to process deprecations, in which case this method has no effect.

Implementation

static DeprecationProcessingLogger wrapLogger(
    Logger? logger,
    Iterable<Deprecation>? silenceDeprecations,
    Iterable<Deprecation>? fatalDeprecations,
    Iterable<Deprecation>? futureDeprecations,
    {bool color = false}) {
  if (logger is DeprecationProcessingLogger) return logger;
  return DeprecationProcessingLogger(logger ?? Logger.stderr(color: color),
      silenceDeprecations: {...?silenceDeprecations},
      fatalDeprecations: {...?fatalDeprecations},
      futureDeprecations: {...?futureDeprecations},
      limitRepetition: false);
}