text: "use strict";
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
      function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
      return new (P || (P = Promise))(function (resolve, reject) {
          function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
          function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
          function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
          step((generator = generator.apply(thisArg, _arguments || [])).next());
      });
  };
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.logger = void 0;
  const logEvent_1 = require("../units/logEvent/logEvent");
  exports.logger = ({ info, context }, next) => __awaiter(void 0, void 0, void 0, function* () {
      const start = Date.now();
      const res = yield next();
      if (["Query", "Mutation"].indexOf(info.parentType.name) >= 0) {
          const resolveTime = Date.now() - start;
          try {
              yield logEvent_1.default({
                  referrer: context.referrer,
                  type: info.parentType.name,
                  name: info.fieldName,
                  input: info.variableValues,
                  output: res,
                  resolveTime
              });
          }
          catch (err) {
              console.log("Error creating log...", err);
          }
      }
  });
  //# sourceMappingURL=logger.js.map