use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.
the class Debug method debugASN1Write.
/**
* Writes debug information about the provided ASN.1 element to be written,
* if appropriate.
*
* @param l The log level that should be used for the debug information.
* @param b The ASN1Buffer with the information to be written.
*/
public static void debugASN1Write(@NotNull final Level l, @NotNull final ASN1Buffer b) {
if (debugEnabled && debugTypes.contains(DebugType.ASN1)) {
final JSONBuffer buffer = new JSONBuffer();
addCommonHeader(buffer, l, DebugType.ASN1);
buffer.appendString("writing-asn1-element", StaticUtils.toHex(b.toByteArray()));
addCommonFooter(buffer);
log(l, buffer);
}
}
use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.
the class Debug method debugASN1Read.
/**
* Writes debug information about the provided ASN.1 element that was read, if
* appropriate.
*
* @param l The log level that should be used for the debug information.
* @param e The ASN.1 element for which debug information should be written.
*/
public static void debugASN1Read(@NotNull final Level l, @NotNull final ASN1Element e) {
if (debugEnabled && debugTypes.contains(DebugType.ASN1)) {
final JSONBuffer buffer = new JSONBuffer();
addCommonHeader(buffer, l, DebugType.ASN1);
buffer.appendString("read-asn1-element", e.toString());
addCommonFooter(buffer);
log(l, buffer);
}
}
use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.
the class Debug method debugLDIFRead.
/**
* Writes debug information about the provided record read from LDIF, if
* appropriate.
*
* @param l The log level that should be used for the debug information.
* @param r The LDIF record for which debug information should be written.
*/
public static void debugLDIFRead(@NotNull final Level l, @NotNull final LDIFRecord r) {
if (debugEnabled && debugTypes.contains(DebugType.LDIF)) {
final JSONBuffer buffer = new JSONBuffer();
addCommonHeader(buffer, l, DebugType.LDIF);
buffer.appendString("read-ldif-record", r.toString());
addCommonFooter(buffer);
log(l, buffer);
}
}
use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.
the class Debug method debugLDIFWrite.
/**
* Writes debug information about the provided LDIF record to be written, if
* appropriate.
*
* @param l The log level that should be used for the debug information.
* @param r The LDIF record for which debug information should be written.
*/
public static void debugLDIFWrite(@NotNull final Level l, @NotNull final LDIFRecord r) {
if (debugEnabled && debugTypes.contains(DebugType.LDIF)) {
final JSONBuffer buffer = new JSONBuffer();
addCommonHeader(buffer, l, DebugType.LDIF);
buffer.appendString("writing-ldif-record", r.toString());
addCommonFooter(buffer);
log(l, buffer);
}
}
use of com.unboundid.util.json.JSONBuffer in project ldapsdk by pingidentity.
the class Debug method debugLDAPResult.
/**
* Writes debug information about the provided result, if appropriate.
*
* @param l The log level that should be used for the debug information.
* @param r The result for which debug information should be written.
* @param c The connection on which the response was received. It may be
* {@code null} for historic reasons, but should be
* non-{@code null} in new uses.
*/
public static void debugLDAPResult(@NotNull final Level l, @NotNull final LDAPResponse r, @Nullable final LDAPConnection c) {
if (debugEnabled && debugTypes.contains(DebugType.LDAP)) {
final JSONBuffer buffer = new JSONBuffer();
addCommonHeader(buffer, l, DebugType.LDAP);
if (c != null) {
buffer.appendNumber("connection-id", c.getConnectionID());
final String connectionName = c.getConnectionName();
if (connectionName != null) {
buffer.appendString("connection-name", connectionName);
}
final String connectionPoolName = c.getConnectionPoolName();
if (connectionPoolName != null) {
buffer.appendString("connection-pool-name", connectionPoolName);
}
final String connectedAddress = c.getConnectedAddress();
if (connectedAddress != null) {
buffer.appendString("connected-to-address", connectedAddress);
buffer.appendNumber("connected-to-port", c.getConnectedPort());
}
}
buffer.appendString("read-ldap-result", r.toString());
addCommonFooter(buffer);
log(l, buffer);
}
}
Aggregations