setColorPrintersOptions function

void setColorPrintersOptions({
  1. bool? enable,
  2. StringSink? outSink,
  3. StringSink? errSink,
  4. bool? useShortTag,
  5. bool? includeTimestamp,
  6. ConvertCallback<DateTime, String>? timestampFormatter,
})

Sets the options for printVerbose, printInfo, printWarning and printError.

Parameters

  • enable - Whether or not the printer messages should be colorized. Defaults to true.

  • outSink - Output StringSink for non-erroneous messages. Defaults to stdout.

  • outSink - Output StringSink for non-erroneous messages. Defaults to stderr.

  • useShortTag - Whether short log tags should be used. Defaults to false.

  • includeTimestamp - Whether timestamps should be included in the printed messages. Defaults to false.

  • timestampFormatter - If includeTimestamp is true, then this function determines how the DateTime is formatted in the final message. Defaults to DateTime.toString.

Implementation

void setColorPrintersOptions({
  bool? enable,
  StringSink? outSink,
  StringSink? errSink,
  bool? useShortTag,
  bool? includeTimestamp,
  ConvertCallback<DateTime, String>? timestampFormatter,
}) {
  if (null != enable) {
    _shouldColorize = enable;
  }

  if (null != outSink) {
    _outSink = outSink;
  }

  if (null != errSink) {
    _errSink = errSink;
  }

  if (null != useShortTag) {
    _useShortTag = useShortTag;
  }

  if (null != includeTimestamp) {
    _includeTimestamp = includeTimestamp;
  }

  if (null != timestampFormatter) {
    _timestampFormatter = timestampFormatter;
  }
}