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 = '';
    if (optimise is bool) {
      output = '${clientId.toString()}-$now -- $message';
      print(output);
    } else {
      output = '${clientId.toString()}-$now -- $message$optimise';
      print(output);
    }
    if (testMode) {
      testOutput = output;
    }
  }
}