neo4j-driver 4.3.0 → 4.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -320,7 +320,7 @@ var BoltProtocol = /** @class */ (function () {
320
320
  var queued = this.queueObserverIfProtocolIsNotBroken(observer);
321
321
  if (queued) {
322
322
  if (this._log.isDebugEnabled()) {
323
- this._log.debug(this + " C: " + message);
323
+ this._log.debug("C: " + message);
324
324
  }
325
325
  this.packer().packStruct(message.signature, message.fields.map(function (field) { return _this.packer().packable(field); }));
326
326
  this._chunker.messageBoundary();
@@ -1642,13 +1642,13 @@ var ResponseHandler = /** @class */ (function () {
1642
1642
  switch (msg.signature) {
1643
1643
  case RECORD:
1644
1644
  if (this._log.isDebugEnabled()) {
1645
- this._log.debug(this + " S: RECORD " + neo4j_driver_core_1.json.stringify(msg));
1645
+ this._log.debug("S: RECORD " + neo4j_driver_core_1.json.stringify(msg));
1646
1646
  }
1647
1647
  this._currentObserver.onNext(payload);
1648
1648
  break;
1649
1649
  case SUCCESS:
1650
1650
  if (this._log.isDebugEnabled()) {
1651
- this._log.debug(this + " S: SUCCESS " + neo4j_driver_core_1.json.stringify(msg));
1651
+ this._log.debug("S: SUCCESS " + neo4j_driver_core_1.json.stringify(msg));
1652
1652
  }
1653
1653
  try {
1654
1654
  var metadata = this._transformMetadata(payload);
@@ -1660,7 +1660,7 @@ var ResponseHandler = /** @class */ (function () {
1660
1660
  break;
1661
1661
  case FAILURE:
1662
1662
  if (this._log.isDebugEnabled()) {
1663
- this._log.debug(this + " S: FAILURE " + neo4j_driver_core_1.json.stringify(msg));
1663
+ this._log.debug("S: FAILURE " + neo4j_driver_core_1.json.stringify(msg));
1664
1664
  }
1665
1665
  try {
1666
1666
  var error = neo4j_driver_core_1.newError(payload.message, payload.code);
@@ -1675,7 +1675,7 @@ var ResponseHandler = /** @class */ (function () {
1675
1675
  break;
1676
1676
  case IGNORED:
1677
1677
  if (this._log.isDebugEnabled()) {
1678
- this._log.debug(this + " S: IGNORED " + neo4j_driver_core_1.json.stringify(msg));
1678
+ this._log.debug("S: IGNORED " + neo4j_driver_core_1.json.stringify(msg));
1679
1679
  }
1680
1680
  try {
1681
1681
  if (this._currentFailure && this._currentObserver.onError) {
@@ -5134,6 +5134,7 @@ var neo4j_driver_core_1 = require("neo4j-driver-core");
5134
5134
  var connection_1 = __importDefault(require("./connection"));
5135
5135
  var bolt_1 = __importDefault(require("../bolt"));
5136
5136
  var PROTOCOL_ERROR = neo4j_driver_core_1.error.PROTOCOL_ERROR;
5137
+ var Logger = neo4j_driver_core_1.internal.logger.Logger;
5137
5138
  var idGenerator = 0;
5138
5139
  /**
5139
5140
  * Crete new connection to the provided address. Returned connection is not connected.
@@ -5156,7 +5157,6 @@ function createChannelConnection(address, config, errorHandler, log, serversideR
5156
5157
  var createProtocol = function (conn) {
5157
5158
  return bolt_1.default.create({
5158
5159
  version: version,
5159
- connection: conn,
5160
5160
  channel: channel,
5161
5161
  chunker: chunker,
5162
5162
  dechunker: dechunker,
@@ -5164,7 +5164,7 @@ function createChannelConnection(address, config, errorHandler, log, serversideR
5164
5164
  useBigInt: config.useBigInt,
5165
5165
  serversideRouting: serversideRouting,
5166
5166
  server: conn.server,
5167
- log: log,
5167
+ log: conn.logger,
5168
5168
  observer: {
5169
5169
  onError: conn._handleFatalError.bind(conn),
5170
5170
  onFailure: conn._resetOnFailure.bind(conn),
@@ -5211,7 +5211,7 @@ var ChannelConnection = /** @class */ (function (_super) {
5211
5211
  _this._disableLosslessIntegers = disableLosslessIntegers;
5212
5212
  _this._ch = channel;
5213
5213
  _this._chunker = chunker;
5214
- _this._log = log;
5214
+ _this._log = createConnectionLogger(_this, log);
5215
5215
  _this._serversideRouting = serversideRouting;
5216
5216
  // connection from the database, returned in response for HELLO message and might not be available
5217
5217
  _this._dbConnectionId = null;
@@ -5224,7 +5224,7 @@ var ChannelConnection = /** @class */ (function (_super) {
5224
5224
  // Set to true on fatal errors, to get this out of connection pool.
5225
5225
  _this._isBroken = false;
5226
5226
  if (_this._log.isDebugEnabled()) {
5227
- _this._log.debug(_this + " created towards " + address);
5227
+ _this._log.debug("created towards " + address);
5228
5228
  }
5229
5229
  return _this;
5230
5230
  }
@@ -5323,6 +5323,13 @@ var ChannelConnection = /** @class */ (function (_super) {
5323
5323
  enumerable: false,
5324
5324
  configurable: true
5325
5325
  });
5326
+ Object.defineProperty(ChannelConnection.prototype, "logger", {
5327
+ get: function () {
5328
+ return this._log;
5329
+ },
5330
+ enumerable: false,
5331
+ configurable: true
5332
+ });
5326
5333
  /**
5327
5334
  * "Fatal" means the connection is dead. Only call this if something
5328
5335
  * happens that cannot be recovered from. This will lead to all subscribers
@@ -5334,7 +5341,7 @@ var ChannelConnection = /** @class */ (function (_super) {
5334
5341
  this._isBroken = true;
5335
5342
  this._error = this.handleAndTransformError(error, this._address);
5336
5343
  if (this._log.isErrorEnabled()) {
5337
- this._log.error(this + " experienced a fatal error " + neo4j_driver_core_1.json.stringify(this._error));
5344
+ this._log.error("experienced a fatal error " + neo4j_driver_core_1.json.stringify(this._error));
5338
5345
  }
5339
5346
  this._protocol.notifyFatalError(this._error);
5340
5347
  };
@@ -5405,7 +5412,7 @@ var ChannelConnection = /** @class */ (function (_super) {
5405
5412
  switch (_a.label) {
5406
5413
  case 0:
5407
5414
  if (this._log.isDebugEnabled()) {
5408
- this._log.debug(this + " closing");
5415
+ this._log.debug('closing');
5409
5416
  }
5410
5417
  if (this._protocol && this.isOpen()) {
5411
5418
  // protocol has been initialized and this connection is healthy
@@ -5416,7 +5423,7 @@ var ChannelConnection = /** @class */ (function (_super) {
5416
5423
  case 1:
5417
5424
  _a.sent();
5418
5425
  if (this._log.isDebugEnabled()) {
5419
- this._log.debug(this + " closed");
5426
+ this._log.debug('closed');
5420
5427
  }
5421
5428
  return [2 /*return*/];
5422
5429
  }
@@ -5436,6 +5443,17 @@ var ChannelConnection = /** @class */ (function (_super) {
5436
5443
  return ChannelConnection;
5437
5444
  }(connection_1.default));
5438
5445
  exports.default = ChannelConnection;
5446
+ /**
5447
+ * Creates a log with the connection info as prefix
5448
+ * @param {Connection} connection The connection
5449
+ * @param {Logger} logger The logger
5450
+ * @returns {Logger} The new logger with enriched messages
5451
+ */
5452
+ function createConnectionLogger(connection, logger) {
5453
+ return new Logger(logger._level, function (level, message) {
5454
+ return logger._loggerFunction(level, connection + " " + message);
5455
+ });
5456
+ }
5439
5457
 
5440
5458
  },{"../bolt":11,"../channel":26,"./connection":35,"neo4j-driver-core":58}],33:[function(require,module,exports){
5441
5459
  "use strict";
@@ -27751,7 +27769,7 @@ exports["default"] = void 0;
27751
27769
  // This is set up this way to keep the version in the code in
27752
27770
  // sync with the npm package version, and to allow the build
27753
27771
  // system to control version names at packaging time.
27754
- var _default = '4.3.0';
27772
+ var _default = '4.3.1';
27755
27773
  exports["default"] = _default;
27756
27774
 
27757
27775
  },{}]},{},[296])(296)