function $AdfServerLogWriter$$() {
  this.Init();
}
$goog$exportSymbol$$("AdfServerLogWriter", $AdfServerLogWriter$$);
$AdfObject$$.$createSubclass$($AdfServerLogWriter$$, $AdfLogWriter$$);
$AdfServerLogWriter$$.prototype.flush = function $$AdfServerLogWriter$$$$flush$() {
  this.$CheckIfClosed$();
  if (this.$_loggedMessages$.length) {
    if (window.JSON) {
      var $xmlHttp$$ = $AdfAgent$$.$AGENT$.$createXMLHttpRequest$();
      $xmlHttp$$ && this.$_sendRequest$($xmlHttp$$, this.$_loggedMessages$);
    }
    this.$_clear$();
  }
};
$AdfObject$$.$exportPrototypeSymbol$("AdfServerLogWriter.prototype.flush", {flush:$AdfServerLogWriter$$.prototype.flush});
$AdfServerLogWriter$$.$_JSONStringifyRecord$ = function $$AdfServerLogWriter$$$$_JSONStringifyRecord$$($logRecord$$7$$) {
  try {
    return JSON.stringify($logRecord$$7$$);
  } catch ($stringifyError$$) {
    return null;
  }
};
$AdfServerLogWriter$$.$_RECORD_PROPERTIES$ = ["level", "message", "error", "when", "responseId"];
$AdfServerLogWriter$$.$_jsonProperty$ = function $$AdfServerLogWriter$$$$_jsonProperty$$($key$$36$$, $value$$130$$) {
  if (void 0 === $value$$130$$) {
    return null;
  }
  var $stringValue$$1$$;
  switch(typeof $value$$130$$) {
    case "boolean":
    ;
    case "number":
      $stringValue$$1$$ = "" + $value$$130$$;
      break;
    default:
      $stringValue$$1$$ = '"' + $value$$130$$ + '"';
  }
  return '"' + $key$$36$$ + '":' + $stringValue$$1$$;
};
$AdfServerLogWriter$$.$_shallowStringifyRecord$ = function $$AdfServerLogWriter$$$$_shallowStringifyRecord$$($logRecord$$8$$) {
  try {
    for (var $recordProperties$$ = $AdfServerLogWriter$$.$_RECORD_PROPERTIES$, $propertyCount$$1$$ = $recordProperties$$.length, $properties$$29$$ = Array($propertyCount$$1$$), $i$$65$$ = 0;$i$$65$$ < $propertyCount$$1$$;$i$$65$$++) {
      var $propertyName$$29$$ = $recordProperties$$[$i$$65$$], $jsonProperty$$ = $AdfServerLogWriter$$.$_jsonProperty$($propertyName$$29$$, $logRecord$$8$$[$propertyName$$29$$]);
      $jsonProperty$$ && $properties$$29$$.push($jsonProperty$$);
    }
    return "{" + $properties$$29$$.join(",") + "}";
  } catch ($stringifyError$$1$$) {
    return null;
  }
};
$AdfServerLogWriter$$.prototype.$_sendRequest$ = function $$AdfServerLogWriter$$$$$_sendRequest$$($xmlHttp$$1$$, $loggedMessages$$1$$) {
  var $content$$1_jsonMessages$$1$$ = JSON.stringify($loggedMessages$$1$$), $content$$1_jsonMessages$$1$$ = "logRecords\x3d" + encodeURIComponent($content$$1_jsonMessages$$1$$).replace(/\'/g, "%27").replace(/%20/g, "+"), $endPointUrl$$inline_390$$ = null, $form$$inline_391$$ = document.forms[0];
  $form$$inline_391$$ && ($endPointUrl$$inline_390$$ = $form$$inline_391$$.action);
  $endPointUrl$$inline_390$$ || ($endPointUrl$$inline_390$$ = document.location.href);
  $xmlHttp$$1$$.open("POST", $endPointUrl$$inline_390$$, !0);
  $xmlHttp$$1$$.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  $xmlHttp$$1$$.setRequestHeader("Adf-Rich-Log", "true");
  $xmlHttp$$1$$.send($content$$1_jsonMessages$$1$$);
};
$AdfServerLogWriter$$.prototype.Init = function $$AdfServerLogWriter$$$$Init$() {
  $AdfServerLogWriter$$.$superclass$.Init.call(this);
  this.$_clear$();
};
$AdfObject$$.$exportPrototypeSymbol$("AdfServerLogWriter.prototype.Init", {Init:$AdfServerLogWriter$$.prototype.Init});
$AdfServerLogWriter$$.prototype.$_clear$ = function $$AdfServerLogWriter$$$$$_clear$$() {
  this.$_loggedMessages$ = [];
};
$AdfServerLogWriter$$.prototype.$PublishImpl$ = function $$AdfServerLogWriter$$$$$PublishImpl$$($logRecord$$10$$) {
  this.$CheckIfClosed$();
  $AdfAssert$$.assert($logRecord$$10$$, "null logRecord");
  this.$_loggedMessages$.push($logRecord$$10$$);
};
$AdfObject$$.$exportPrototypeSymbol$("AdfServerLogWriter.prototype.PublishImpl", {$PublishImpl$:$AdfServerLogWriter$$.prototype.$PublishImpl$});
