json static method

dynamic json(
  1. dynamic message, {
  2. bool alwaysPrint = false,
})

Log json data message to the console. It will only print if your app's environment is in debug mode. You can override this by setting alwaysPrint = true.

Implementation

static json(dynamic message, {bool alwaysPrint = false}) {
  bool canPrint = (getEnv('APP_DEBUG', defaultValue: true));
  if (!canPrint && !alwaysPrint) return;
  try {
    log(jsonEncode(message));
  } on Exception catch (e) {
    NyLogger.error(e.toString());
  }
}