New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@azure/core-amqp

Package Overview
Dependencies
Maintainers
1
Versions
434
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/core-amqp - npm Package Compare versions

Comparing version 1.0.0-dev.20191220.1 to 1.0.0-dev.20191221.1

34

dist-esm/src/cbs.js

@@ -6,3 +6,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import * as Constants from "./util/constants";
import * as log from "./log";
import { logger, logErrorStackTrace } from "./log";
import { translate } from "./errors";

@@ -48,3 +48,3 @@ import { defaultLock } from "./util/utils";

if (!this.connection.isOpen()) {
log.cbs("The CBS client is trying to establish an AMQP connection.");
logger.verbose("The CBS client is trying to establish an AMQP connection.");
yield defaultLock.acquire(this.connectionLock, () => {

@@ -63,7 +63,7 @@ return this.connection.open();

const ehError = translate(context.session.error);
log.error("[%s] An error occurred on the session for request/response links " + "for $cbs: %O", id, ehError);
logger.verbose("[%s] An error occurred on the session for request/response links " + "for $cbs: %O", id, ehError);
}
};
const srOpt = { target: { address: this.endpoint } };
log.cbs("[%s] Creating sender/receiver links on a session for $cbs endpoint.", this.connection.id);
logger.verbose("[%s] Creating sender/receiver links on a session for $cbs endpoint.", this.connection.id);
this._cbsSenderReceiverLink = yield RequestResponseLink.create(this.connection, srOpt, rxOpt);

@@ -73,3 +73,3 @@ this._cbsSenderReceiverLink.sender.on(SenderEvents.senderError, (context) => {

const ehError = translate(context.sender.error);
log.error("[%s] An error occurred on the cbs sender link.. %O", id, ehError);
logger.verbose("[%s] An error occurred on the cbs sender link.. %O", id, ehError);
});

@@ -79,9 +79,9 @@ this._cbsSenderReceiverLink.receiver.on(ReceiverEvents.receiverError, (context) => {

const ehError = translate(context.receiver.error);
log.error("[%s] An error occurred on the cbs receiver link.. %O", id, ehError);
logger.verbose("[%s] An error occurred on the cbs receiver link.. %O", id, ehError);
});
log.cbs("[%s] Successfully created the cbs sender '%s' and receiver '%s' " +
logger.verbose("[%s] Successfully created the cbs sender '%s' and receiver '%s' " +
"links over cbs session.", this.connection.id, this._cbsSenderReceiverLink.sender.name, this._cbsSenderReceiverLink.receiver.name);
}
else {
log.cbs("[%s] CBS session is already present. Reusing the cbs sender '%s' " +
logger.verbose("[%s] CBS session is already present. Reusing the cbs sender '%s' " +
"and receiver '%s' links over cbs session.", this.connection.id, this._cbsSenderReceiverLink.sender.name, this._cbsSenderReceiverLink.receiver.name);

@@ -92,3 +92,4 @@ }

err = translate(err);
log.error("[%s] An error occured while establishing the cbs links: %O", this.connection.id, err);
logger.warning("[%s] An error occured while establishing the cbs links: %O", this.connection.id, err);
logErrorStackTrace(err);
throw err;

@@ -145,7 +146,8 @@ }

const responseMessage = yield this._cbsSenderReceiverLink.sendRequest(request);
log.cbs("[%s] The CBS response is: %O", this.connection.id, responseMessage);
logger.verbose("[%s] The CBS response is: %O", this.connection.id, responseMessage);
return this._fromAmqpMessageResponse(responseMessage);
}
catch (err) {
log.error("[%s] An error occurred while negotiating the cbs claim: %O", this.connection.id, err);
logger.warning("[%s] An error occurred while negotiating the cbs claim: %O", this.connection.id, err);
logErrorStackTrace(err);
throw err;

@@ -167,3 +169,3 @@ }

yield cbsLink.close();
log.cbs("[%s] Successfully closed the cbs session.", this.connection.id);
logger.verbose("[%s] Successfully closed the cbs session.", this.connection.id);
}

@@ -174,3 +176,3 @@ }

JSON.stringify(err)}.`;
log.error("[%s] %s", this.connection.id, msg);
logger.verbose("[%s] %s", this.connection.id, msg);
throw new Error(msg);

@@ -190,3 +192,3 @@ }

cbsLink.remove();
log.cbs("[%s] Successfully removed the cbs session.", this.connection.id);
logger.verbose("[%s] Successfully removed the cbs session.", this.connection.id);
}

@@ -197,3 +199,3 @@ }

JSON.stringify(err)}.`;
log.error("[%s] %s", this.connection.id, msg);
logger.verbose("[%s] %s", this.connection.id, msg);
throw new Error(msg);

@@ -218,3 +220,3 @@ }

};
log.cbs("[%s] The deserialized CBS response is: %o", this.connection.id, cbsResponse);
logger.verbose("[%s] The deserialized CBS response is: %o", this.connection.id, cbsResponse);
return cbsResponse;

@@ -221,0 +223,0 @@ }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { message } from "rhea-promise";
import * as log from "./log";
import { logger, logErrorStackTrace } from "./log";
import isBuffer from "is-buffer";

@@ -24,3 +24,3 @@ import { Buffer } from "buffer";

let result;
log.transformer("[encode] The given message body that needs to be encoded is: ", body);
logger.verbose("[encode] The given message body that needs to be encoded is: ", body);
if (isBuffer(body)) {

@@ -43,7 +43,8 @@ result = message.data_section(body);

`${err ? err.stack : JSON.stringify(err)}`;
log.error("[encode] " + msg);
logger.warning("[encode] " + msg);
logErrorStackTrace(err);
throw new Error(msg);
}
}
log.transformer("[encode] The encoded message body is: %O.", result);
logger.verbose("[encode] The encoded message body is: %O.", result);
return result;

@@ -62,3 +63,3 @@ }

try {
log.transformer("[decode] Received message body for decoding is: %O", body);
logger.verbose("[decode] Received message body for decoding is: %O", body);
if (body.content && isBuffer(body.content)) {

@@ -75,3 +76,3 @@ // This indicates that we are getting the AMQP described type. Let us try decoding it.

catch (err) {
log.error("[decode] An error occurred while trying JSON.parse() on the received body. " +
logger.verbose("[decode] An error occurred while trying JSON.parse() on the received body. " +
"The error is %O", err);

@@ -81,5 +82,5 @@ }

catch (err) {
log.error("[decode] An error occurred while decoding the received message body. The error is: %O", err);
logger.verbose("[decode] An error occurred while decoding the received message body. The error is: %O", err);
}
log.transformer("[decode] The decoded message body is: %O", processedBody);
logger.verbose("[decode] The decoded message body is: %O", processedBody);
return processedBody;

@@ -86,0 +87,0 @@ }

@@ -23,2 +23,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

export { delay, Timeout, executePromisesSequentially, parseConnectionString, defaultLock, getNewAsyncLock, isIotHubConnectionString, randomNumberFromInterval, AsyncLock, isNode } from "./util/utils";
export { logger } from "./log";
//# sourceMappingURL=index.js.map
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import debugModule from "debug";
import { createClientLogger } from "@azure/logger";
/**
* @ignore
* log statements for cbs
* The @azure/logger configuration for this package.
* This will output logs using the `azure:event-hubs` namespace prefix.
*/
export const cbs = debugModule("azure:core-amqp:cbs");
export const logger = createClientLogger("core-amqp");
/**
* Logs the error's stack trace to "verbose" if a stack trace is available.
* @param error Error containing a stack trace.
* @ignore
* log statements for error
*/
export const error = debugModule("azure:core-amqp:error");
/**
* @ignore
* log statements for datatransformer
*/
export const transformer = debugModule("azure:core-amqp:datatransformer");
/**
* @ignore
* log statements for messageHeader
*/
export const msgHeader = debugModule("azure:core-amqp:messageHeader");
/**
* @ignore
* log statements for messageProperties
*/
export const msgProperties = debugModule("azure:core-amqp:messageProperties");
/**
* @ignore
* log statements for retry
*/
export const retry = debugModule("azure:core-amqp:retry");
/**
* @ignore
* log statements for reqreslink
*/
export const reqres = debugModule("azure:core-amqp:reqreslink");
export function logErrorStackTrace(error) {
if (error && error.stack) {
logger.verbose(error.stack);
}
}
//# sourceMappingURL=log.js.map
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import * as log from "./log";
import { logger } from "./log";
/**

@@ -32,3 +32,3 @@ * Describes the operations that can be performed on the message header.

}
log.msgHeader("To AmqpMessageHeader: %O", amqpHeader);
logger.verbose("To AmqpMessageHeader: %O", amqpHeader);
return amqpHeader;

@@ -60,3 +60,3 @@ }

}
log.msgHeader("From AmqpMessageHeader: %O", msgHeader);
logger.verbose("From AmqpMessageHeader: %O", msgHeader);
return msgHeader;

@@ -63,0 +63,0 @@ }

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import * as log from "./log";
import { logger } from "./log";
/**

@@ -56,3 +56,3 @@ * Describes the operations that can be performed on the amqp message properties.

}
log.msgProperties("To AmqpMessageProperties: %O", amqpProperties);
logger.verbose("To AmqpMessageProperties: %O", amqpProperties);
return amqpProperties;

@@ -107,3 +107,3 @@ }

}
log.msgProperties("From AmqpMessageProperties: %O", msgProperties);
logger.verbose("From AmqpMessageProperties: %O", msgProperties);
return msgProperties;

@@ -110,0 +110,0 @@ }

@@ -8,3 +8,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import { translate, ConditionStatusMapper } from "./errors";
import * as log from "./log";
import { logger, logErrorStackTrace } from "./log";
/**

@@ -62,3 +62,4 @@ * Describes an amqp request(sender)-response(receiver) link that is created over an amqp session.

`to "${address}" has been cancelled by the user.`;
log.error(desc);
// Cancellation is a user-intended action, so log to info instead of warning.
logger.info(desc);
const error = new AbortError(`The ${requestName ? requestName + " " : ""}operation has been cancelled by the user.`);

@@ -102,3 +103,3 @@ reject(error);

const responseCorrelationId = context.message.correlation_id;
log.reqres("[%s] %s response: ", this.connection.id, request.to || "$management", context.message);
logger.verbose("[%s] %s response: ", this.connection.id, request.to || "$management", context.message);
if (request.message_id !== responseCorrelationId &&

@@ -109,3 +110,3 @@ request.correlation_id !== responseCorrelationId) {

// request via correlationId is found.
log.error("[%s] request-messageId | '%s' != '%s' | response-correlationId. " +
logger.verbose("[%s] request-messageId | '%s' != '%s' | response-correlationId. " +
"Hence dropping this response and waiting for the next one.", this.connection.id, request.message_id, responseCorrelationId);

@@ -120,3 +121,3 @@ return;

}
log.reqres("[%s] request-messageId | '%s' == '%s' | response-correlationId.", this.connection.id, request.message_id, responseCorrelationId);
logger.verbose("[%s] request-messageId | '%s' == '%s' | response-correlationId.", this.connection.id, request.message_id, responseCorrelationId);
return resolve(context.message);

@@ -131,3 +132,4 @@ }

const error = translate(e);
log.error(error);
logger.warning(error);
logErrorStackTrace(error);
return reject(error);

@@ -153,3 +155,3 @@ }

this.receiver.on(ReceiverEvents.message, messageCallback);
log.reqres("[%s] %s request sent: %O", this.connection.id, request.to || "$managment", request);
logger.verbose("[%s] %s request sent: %O", this.connection.id, request.to || "$managment", request);
this.sender.send(request);

@@ -191,3 +193,3 @@ });

const receiver = yield session.createReceiver(receiverOptions);
log.reqres("[%s] Successfully created the sender and receiver links on the same session.", connection.id);
logger.verbose("[%s] Successfully created the sender and receiver links on the same session.", connection.id);
return new RequestResponseLink(session, sender, receiver);

@@ -194,0 +196,0 @@ });

@@ -6,3 +6,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import { delay } from "./util/utils";
import * as log from "./log";
import { logger } from "./log";
import { defaultMaxRetries, defaultDelayBetweenOperationRetriesInMs, defaultMaxDelayForExponentialRetryInMs } from "./util/constants";

@@ -103,9 +103,9 @@ import { checkNetworkConnection } from "./util/checkNetworkConnection";

for (let i = 1; i <= totalNumberOfAttempts; i++) {
log.retry("[%s] Attempt number: %d", config.connectionId, config.operationType, i);
logger.verbose("[%s] Attempt number: %d", config.connectionId, config.operationType, i);
try {
result = yield config.operation();
success = true;
log.retry("[%s] Success for '%s', after attempt number: %d.", config.connectionId, config.operationType, i);
logger.verbose("[%s] Success for '%s', after attempt number: %d.", config.connectionId, config.operationType, i);
if (result && !isDelivery(result)) {
log.retry("[%s] Success result for '%s': %O", config.connectionId, config.operationType, result);
logger.verbose("[%s] Success result for '%s': %O", config.connectionId, config.operationType, result);
}

@@ -126,3 +126,3 @@ break;

lastError = err;
log.error("[%s] Error occured for '%s' in attempt number %d: %O", config.connectionId, config.operationType, i, err);
logger.verbose("[%s] Error occured for '%s' in attempt number %d: %O", config.connectionId, config.operationType, i, err);
let targetDelayInMs = config.retryOptions.retryDelayInMs;

@@ -138,3 +138,3 @@ if (config.retryOptions.mode === RetryMode.Exponential) {

if (lastError && lastError.retryable) {
log.error("[%s] Sleeping for %d milliseconds for '%s'.", config.connectionId, targetDelayInMs, config.operationType);
logger.verbose("[%s] Sleeping for %d milliseconds for '%s'.", config.connectionId, targetDelayInMs, config.operationType);
yield delay(targetDelayInMs, config.abortSignal, `The retry operation has been cancelled by the user.`);

@@ -141,0 +141,0 @@ continue;

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { resolve, CONNREFUSED, TIMEOUT } from "dns";
import { retry as logRetry } from "../log";
import { logger } from "../log";
/**

@@ -12,6 +12,6 @@ * Checks whether a network connection is detected.

return new Promise((res) => {
logRetry("Calling dns.resolve to determine network connection status.");
logger.verbose("Calling dns.resolve to determine network connection status.");
resolve(host, function (err) {
if (err) {
logRetry("Error thrown from dns.resolve in network connection check: '%s', %O", err.code || err.name, err);
logger.verbose("Error thrown from dns.resolve in network connection check: '%s', %O", err.code || err.name, err);
// List of possible DNS error codes: https://nodejs.org/dist/latest-v12.x/docs/api/dns.html#dns_error_codes

@@ -24,3 +24,3 @@ // Only when dns.resolve returns an error we expect to see when the network is down, resolve as 'false'.

else {
logRetry("Successfully resolved host via dns.resolve in network connection check.");
logger.verbose("Successfully resolved host via dns.resolve in network connection check.");
}

@@ -27,0 +27,0 @@ return res(true);

{
"name": "@azure/core-amqp",
"sdk-type": "client",
"version": "1.0.0-dev.20191220.1",
"version": "1.0.0-dev.20191221.1",
"description": "Common library for amqp based azure sdks like @azure/event-hubs.",

@@ -61,2 +61,3 @@ "author": "Microsoft Corporation",

"@azure/core-auth": "^1.0.0",
"@azure/logger": "^1.0.0",
"@types/async-lock": "^1.1.0",

@@ -63,0 +64,0 @@ "@types/is-buffer": "^2.0.0",

@@ -233,3 +233,3 @@ # Azure Core AMQP client library for AMQP operations

If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/tree/5d25d080d7ac79205b29fb1c8b70ff4da0c0bf1c/CONTRIBUTING.md) to learn more about how to build and test the code.
If you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/tree/690c5628105e76248ae7b63b3fa743564540487c/CONTRIBUTING.md) to learn more about how to build and test the code.

@@ -236,0 +236,0 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

@@ -17,3 +17,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import * as Constants from "./util/constants";
import * as log from "./log";
import { logger, logErrorStackTrace } from "./log";
import { translate } from "./errors";

@@ -86,3 +86,3 @@ import { defaultLock } from "./util/utils";

if (!this.connection.isOpen()) {
log.cbs("The CBS client is trying to establish an AMQP connection.");
logger.verbose("The CBS client is trying to establish an AMQP connection.");
await defaultLock.acquire(this.connectionLock, () => {

@@ -102,3 +102,3 @@ return this.connection.open();

const ehError = translate(context.session!.error!);
log.error(
logger.verbose(
"[%s] An error occurred on the session for request/response links " + "for $cbs: %O",

@@ -111,3 +111,3 @@ id,

const srOpt: SenderOptions = { target: { address: this.endpoint } };
log.cbs(
logger.verbose(
"[%s] Creating sender/receiver links on a session for $cbs endpoint.",

@@ -124,3 +124,3 @@ this.connection.id

const ehError = translate(context.sender!.error!);
log.error("[%s] An error occurred on the cbs sender link.. %O", id, ehError);
logger.verbose("[%s] An error occurred on the cbs sender link.. %O", id, ehError);
});

@@ -132,6 +132,6 @@ this._cbsSenderReceiverLink.receiver.on(

const ehError = translate(context.receiver!.error!);
log.error("[%s] An error occurred on the cbs receiver link.. %O", id, ehError);
logger.verbose("[%s] An error occurred on the cbs receiver link.. %O", id, ehError);
}
);
log.cbs(
logger.verbose(
"[%s] Successfully created the cbs sender '%s' and receiver '%s' " +

@@ -144,3 +144,3 @@ "links over cbs session.",

} else {
log.cbs(
logger.verbose(
"[%s] CBS session is already present. Reusing the cbs sender '%s' " +

@@ -155,3 +155,3 @@ "and receiver '%s' links over cbs session.",

err = translate(err);
log.error(
logger.warning(
"[%s] An error occured while establishing the cbs links: %O",

@@ -161,2 +161,3 @@ this.connection.id,

);
logErrorStackTrace(err);
throw err;

@@ -216,6 +217,6 @@ }

const responseMessage = await this._cbsSenderReceiverLink!.sendRequest(request);
log.cbs("[%s] The CBS response is: %O", this.connection.id, responseMessage);
logger.verbose("[%s] The CBS response is: %O", this.connection.id, responseMessage);
return this._fromAmqpMessageResponse(responseMessage);
} catch (err) {
log.error(
logger.warning(
"[%s] An error occurred while negotiating the cbs claim: %O",

@@ -225,2 +226,3 @@ this.connection.id,

);
logErrorStackTrace(err);
throw err;

@@ -241,3 +243,3 @@ }

await cbsLink!.close();
log.cbs("[%s] Successfully closed the cbs session.", this.connection.id);
logger.verbose("[%s] Successfully closed the cbs session.", this.connection.id);
}

@@ -247,3 +249,3 @@ } catch (err) {

JSON.stringify(err)}.`;
log.error("[%s] %s", this.connection.id, msg);
logger.verbose("[%s] %s", this.connection.id, msg);
throw new Error(msg);

@@ -263,3 +265,3 @@ }

cbsLink!.remove();
log.cbs("[%s] Successfully removed the cbs session.", this.connection.id);
logger.verbose("[%s] Successfully removed the cbs session.", this.connection.id);
}

@@ -269,3 +271,3 @@ } catch (err) {

JSON.stringify(err)}.`;
log.error("[%s] %s", this.connection.id, msg);
logger.verbose("[%s] %s", this.connection.id, msg);
throw new Error(msg);

@@ -292,5 +294,5 @@ }

};
log.cbs("[%s] The deserialized CBS response is: %o", this.connection.id, cbsResponse);
logger.verbose("[%s] The deserialized CBS response is: %o", this.connection.id, cbsResponse);
return cbsResponse;
}
}

@@ -5,3 +5,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import { message } from "rhea-promise";
import * as log from "./log";
import { logger, logErrorStackTrace } from "./log";
import isBuffer from "is-buffer";

@@ -46,3 +46,3 @@ import { Buffer } from "buffer";

let result: any;
log.transformer("[encode] The given message body that needs to be encoded is: ", body);
logger.verbose("[encode] The given message body that needs to be encoded is: ", body);
if (isBuffer(body)) {

@@ -63,7 +63,8 @@ result = message.data_section(body);

`${err ? err.stack : JSON.stringify(err)}`;
log.error("[encode] " + msg);
logger.warning("[encode] " + msg);
logErrorStackTrace(err);
throw new Error(msg);
}
}
log.transformer("[encode] The encoded message body is: %O.", result);
logger.verbose("[encode] The encoded message body is: %O.", result);
return result;

@@ -83,3 +84,3 @@ }

try {
log.transformer("[decode] Received message body for decoding is: %O", body);
logger.verbose("[decode] Received message body for decoding is: %O", body);
if (body.content && isBuffer(body.content)) {

@@ -95,3 +96,3 @@ // This indicates that we are getting the AMQP described type. Let us try decoding it.

} catch (err) {
log.error(
logger.verbose(
"[decode] An error occurred while trying JSON.parse() on the received body. " +

@@ -103,3 +104,3 @@ "The error is %O",

} catch (err) {
log.error(
logger.verbose(
"[decode] An error occurred while decoding the received message body. The error is: %O",

@@ -109,5 +110,5 @@ err

}
log.transformer("[decode] The decoded message body is: %O", processedBody);
logger.verbose("[decode] The decoded message body is: %O", processedBody);
return processedBody;
}
}

@@ -64,1 +64,2 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

} from "./util/utils";
export { logger } from "./log";
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import debugModule from "debug";
import { createClientLogger } from "@azure/logger";
/**
* @ignore
* log statements for cbs
* The @azure/logger configuration for this package.
* This will output logs using the `azure:event-hubs` namespace prefix.
*/
export const cbs = debugModule("azure:core-amqp:cbs");
export const logger = createClientLogger("core-amqp");
/**
* Logs the error's stack trace to "verbose" if a stack trace is available.
* @param error Error containing a stack trace.
* @ignore
* log statements for error
*/
export const error = debugModule("azure:core-amqp:error");
/**
* @ignore
* log statements for datatransformer
*/
export const transformer = debugModule("azure:core-amqp:datatransformer");
/**
* @ignore
* log statements for messageHeader
*/
export const msgHeader = debugModule("azure:core-amqp:messageHeader");
/**
* @ignore
* log statements for messageProperties
*/
export const msgProperties = debugModule("azure:core-amqp:messageProperties");
/**
* @ignore
* log statements for retry
*/
export const retry = debugModule("azure:core-amqp:retry");
/**
* @ignore
* log statements for reqreslink
*/
export const reqres = debugModule("azure:core-amqp:reqreslink");
export function logErrorStackTrace(error: any) {
if (error && error.stack) {
logger.verbose(error.stack);
}
}

@@ -5,3 +5,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import { MessageHeader as AmqpMessageHeader } from "rhea-promise";
import * as log from "./log";
import { logger } from "./log";

@@ -64,3 +64,3 @@ /**

}
log.msgHeader("To AmqpMessageHeader: %O", amqpHeader);
logger.verbose("To AmqpMessageHeader: %O", amqpHeader);
return amqpHeader;

@@ -92,5 +92,5 @@ }

}
log.msgHeader("From AmqpMessageHeader: %O", msgHeader);
logger.verbose("From AmqpMessageHeader: %O", msgHeader);
return msgHeader;
}
}

@@ -5,3 +5,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import { MessageProperties as AmqpMessageProperties } from "rhea-promise";
import * as log from "./log";
import { logger } from "./log";

@@ -122,3 +122,3 @@ /**

log.msgProperties("To AmqpMessageProperties: %O", amqpProperties);
logger.verbose("To AmqpMessageProperties: %O", amqpProperties);
return amqpProperties;

@@ -174,5 +174,5 @@ }

log.msgProperties("From AmqpMessageProperties: %O", msgProperties);
logger.verbose("From AmqpMessageProperties: %O", msgProperties);
return msgProperties;
}
}

@@ -20,3 +20,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import { translate, ConditionStatusMapper } from "./errors";
import * as log from "./log";
import { logger, logErrorStackTrace } from "./log";

@@ -104,3 +104,4 @@ /**

`to "${address}" has been cancelled by the user.`;
log.error(desc);
// Cancellation is a user-intended action, so log to info instead of warning.
logger.info(desc);
const error = new AbortError(

@@ -151,3 +152,3 @@ `The ${requestName ? requestName + " " : ""}operation has been cancelled by the user.`

const responseCorrelationId = context.message!.correlation_id;
log.reqres(
logger.verbose(
"[%s] %s response: ",

@@ -165,3 +166,3 @@ this.connection.id,

// request via correlationId is found.
log.error(
logger.verbose(
"[%s] request-messageId | '%s' != '%s' | response-correlationId. " +

@@ -182,3 +183,3 @@ "Hence dropping this response and waiting for the next one.",

}
log.reqres(
logger.verbose(
"[%s] request-messageId | '%s' == '%s' | response-correlationId.",

@@ -198,3 +199,4 @@ this.connection.id,

const error = translate(e);
log.error(error);
logger.warning(error);
logErrorStackTrace(error);
return reject(error);

@@ -224,3 +226,3 @@ }

log.reqres(
logger.verbose(
"[%s] %s request sent: %O",

@@ -271,3 +273,3 @@ this.connection.id,

const receiver = await session.createReceiver(receiverOptions);
log.reqres(
logger.verbose(
"[%s] Successfully created the sender and receiver links on the same session.",

@@ -274,0 +276,0 @@ connection.id

@@ -6,3 +6,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import { delay } from "./util/utils";
import * as log from "./log";
import { logger } from "./log";
import {

@@ -183,7 +183,7 @@ defaultMaxRetries,

for (let i = 1; i <= totalNumberOfAttempts; i++) {
log.retry("[%s] Attempt number: %d", config.connectionId, config.operationType, i);
logger.verbose("[%s] Attempt number: %d", config.connectionId, config.operationType, i);
try {
result = await config.operation();
success = true;
log.retry(
logger.verbose(
"[%s] Success for '%s', after attempt number: %d.",

@@ -195,3 +195,3 @@ config.connectionId,

if (result && !isDelivery(result)) {
log.retry(
logger.verbose(
"[%s] Success result for '%s': %O",

@@ -217,3 +217,3 @@ config.connectionId,

lastError = err;
log.error(
logger.verbose(
"[%s] Error occured for '%s' in attempt number %d: %O",

@@ -240,3 +240,3 @@ config.connectionId,

if (lastError && lastError.retryable) {
log.error(
logger.verbose(
"[%s] Sleeping for %d milliseconds for '%s'.",

@@ -243,0 +243,0 @@ config.connectionId,

@@ -5,3 +5,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import { resolve, CONNREFUSED, TIMEOUT } from "dns";
import { retry as logRetry } from "../log";
import { logger } from "../log";

@@ -15,6 +15,6 @@ /**

return new Promise((res) => {
logRetry("Calling dns.resolve to determine network connection status.");
logger.verbose("Calling dns.resolve to determine network connection status.");
resolve(host, function(err: any): void {
if (err) {
logRetry(
logger.verbose(
"Error thrown from dns.resolve in network connection check: '%s', %O",

@@ -30,3 +30,3 @@ err.code || err.name,

} else {
logRetry("Successfully resolved host via dns.resolve in network connection check.");
logger.verbose("Successfully resolved host via dns.resolve in network connection check.");
}

@@ -33,0 +33,0 @@

@@ -21,2 +21,3 @@ /// <reference lib="es2015" />

export { delay, Timeout, EventHubConnectionStringModel, executePromisesSequentially, parseConnectionString, IotHubConnectionStringModel, StorageConnectionStringModel, defaultLock, Func, ParsedOutput, getNewAsyncLock, AsyncLockOptions, ServiceBusConnectionStringModel, isIotHubConnectionString, randomNumberFromInterval, AsyncLock, isNode } from "./util/utils";
export { logger } from "./log";
//# sourceMappingURL=index.d.ts.map

@@ -1,37 +0,12 @@

import debugModule from "debug";
/**
* @ignore
* log statements for cbs
* The @azure/logger configuration for this package.
* This will output logs using the `azure:event-hubs` namespace prefix.
*/
export declare const cbs: debugModule.Debugger;
export declare const logger: import("@azure/logger").AzureLogger;
/**
* Logs the error's stack trace to "verbose" if a stack trace is available.
* @param error Error containing a stack trace.
* @ignore
* log statements for error
*/
export declare const error: debugModule.Debugger;
/**
* @ignore
* log statements for datatransformer
*/
export declare const transformer: debugModule.Debugger;
/**
* @ignore
* log statements for messageHeader
*/
export declare const msgHeader: debugModule.Debugger;
/**
* @ignore
* log statements for messageProperties
*/
export declare const msgProperties: debugModule.Debugger;
/**
* @ignore
* log statements for retry
*/
export declare const retry: debugModule.Debugger;
/**
* @ignore
* log statements for reqreslink
*/
export declare const reqres: debugModule.Debugger;
export declare function logErrorStackTrace(error: any): void;
//# sourceMappingURL=log.d.ts.map

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc