log static method

void log(
  1. String message, [
  2. dynamic optimise = false
])

Log method If the optimise parameter is supplied it must have a toString method, this allows large objects such as lots of payload data not to be converted into a string in the message parameter if logging is not enabled.

Implementation

static void log(String message, [dynamic optimise = false]) {
  if (loggingOn) {
    final now = DateTime.now();
    var output = '';
    output = optimise is bool
        ? '${clientId.toString()}-$now -- $message'
        : '${clientId.toString()}-$now -- $message$optimise';
    if (testMode) {
      testOutput = output;
    } else {
      print(output);
    }
  }
}