cgserver 13.2.4 → 13.2.6

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.
@@ -118,6 +118,9 @@ class MongoExt {
118
118
  get debug() {
119
119
  return this._mongocfg.debug;
120
120
  }
121
+ get dbName() {
122
+ return this._connection?.name || "unknown";
123
+ }
121
124
  _connection = null;
122
125
  get connection() {
123
126
  return this._connection;
@@ -5,13 +5,17 @@ const Log_1 = require("../Logic/Log");
5
5
  let MongoActionCheck = function (ret = null) {
6
6
  return function (target, propertyName, descriptor) {
7
7
  let method = descriptor.value;
8
- descriptor.value = function () {
8
+ descriptor.value = async function () {
9
9
  let self = this;
10
10
  try {
11
11
  let start_time = Date.now();
12
- ret = method.apply(this, arguments);
12
+ ret = await method.apply(this, arguments);
13
13
  let dt = Date.now() - start_time;
14
- self.debug && Log_1.gLog.info({ key: method.name, dt, arguments });
14
+ let collection = "unknown";
15
+ if (arguments && arguments[0] && arguments[0].name) {
16
+ collection = arguments[0].name;
17
+ }
18
+ self.debug && Log_1.gLog.info({ collection, action: method.name, dt, arguments, dbName: self.dbName });
15
19
  return ret;
16
20
  }
17
21
  catch (error) {
@@ -79,6 +79,9 @@ class Log {
79
79
  }
80
80
  _convertMsg(message) {
81
81
  if (this._isObject(message)) {
82
+ if (message.value && message.value.stack) {
83
+ message.value = message.value.stack;
84
+ }
82
85
  if (message.stack) {
83
86
  message = message.stack;
84
87
  }
@@ -58,6 +58,7 @@ export declare class MongoExt {
58
58
  get curConnectingCount(): number;
59
59
  get isValid(): boolean;
60
60
  get debug(): boolean;
61
+ get dbName(): string;
61
62
  protected _connection: mongoose.Connection;
62
63
  get connection(): mongoose.Connection;
63
64
  get connected(): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "13.2.4",
3
+ "version": "13.2.6",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",