custom method

void custom(
  1. Object? object, {
  2. int foreColor = 0,
  3. int? backColor,
  4. String tag = 'custom',
})

custom log

Implementation

void custom(
  Object ?object, {
  int foreColor = 0,
  int? backColor,
  String tag = 'custom',
}) {
  DateTime time = DateTime.now();
  int contrastColor = (foreColor < 16 || (foreColor > 231 && foreColor < 244) || ((foreColor - 16) % 36 ~/ 6 > 2)) ? 0 : 15;
  String line = '\x1B[48;5;${foreColor}m\x1B[38;5;${contrastColor}m${object}\x1B[0m c:$foreColor b:$contrastColor';
  printer.print(time, line);
  buffer.add(LogEntity(time, line, level));
  _streamController.add(LogEntity(time, line, level));
}