
  return registerLogEvent(runId, {message, payload, time, type}).then((numberInRun) => {
    // eslint-disable-next-line sort-keys
    const printedString = valueToString(context ? {payload, context} : {payload});

    // eslint-disable-next-line no-console
    console.log(`[e2ed][${dateTimeInISO}][${runLabel}][${runId}] ${message} ${printedString}\n`);

    const pageLoaded = getPageLoaded();

    if (pageLoaded && (type === LogEventType.Action || type === LogEventType.InternalAssert)) {
      return testController.takeScreenshot({path: `${runId}/${numberInRun}`}) as Promise<void>;