cgserver 6.5.7 → 6.5.8

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.
package/README.md CHANGED
@@ -1,4 +1,6 @@
1
1
  6.5.7
2
+ 1、debug标志又cgserver处命令行处理,默认为false
3
+ 6.5.7
2
4
  1、增加配置debug,是否是debug调试模式,主要区别于读取数据档,debug默认读取file_d文件,release默认读取file_r文件,如果不存在都会读取file文件
3
5
  6.5.6
4
6
  1、增加一点服务器事件,目前cgserver只支持start
@@ -3,11 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Config = void 0;
4
4
  const fs = require("fs");
5
5
  const jsonc_1 = require("jsonc");
6
- const FrameworkConfig_1 = require("./FrameworkConfig");
7
6
  class Config {
8
7
  _suffix = "";
9
8
  _is_init = false;
10
9
  _file_name = "";
10
+ /**
11
+ * 是否是debug调试模式,主要区别于读取数据档,debug默认读取file_d文件,release默认读取file_r文件,如果不存在都会读取file文件
12
+ */
13
+ static debug = false;
11
14
  constructor(filename) {
12
15
  this._file_name = filename;
13
16
  }
@@ -16,7 +19,7 @@ class Config {
16
19
  return false;
17
20
  }
18
21
  this._suffix = "r";
19
- if (FrameworkConfig_1.GFCfg.debug) {
22
+ if (Config.debug) {
20
23
  this._suffix = "d";
21
24
  }
22
25
  let path = "data/" + this._file_name + "_" + this._suffix + ".json";
@@ -40,10 +40,6 @@ class FrameworkConfig extends ServerConfig_1.ServerConfig {
40
40
  *-1不输出到console,0,仅错误信息输出到console,1,都输出到console
41
41
  */
42
42
  console_level = 0;
43
- /**
44
- * 是否是debug调试模式,主要区别于读取数据档,debug默认读取file_d文件,release默认读取file_r文件,如果不存在都会读取file文件
45
- */
46
- debug = false;
47
43
  log = {
48
44
  appenders: {
49
45
  console: {
@@ -4,8 +4,13 @@ exports.GCgServer = void 0;
4
4
  const Log_1 = require("./Logic/Log");
5
5
  const EventTool_1 = require("./Logic/EventTool");
6
6
  const Core_1 = require("./Core/Core");
7
+ const Config_1 = require("./Config/Config");
7
8
  class CgServer {
8
9
  _events = {};
10
+ _debug = false;
11
+ get debug() {
12
+ return this._debug;
13
+ }
9
14
  constructor() {
10
15
  this.init();
11
16
  }
@@ -13,6 +18,14 @@ class CgServer {
13
18
  process.on("uncaughtException", this.onUnCaughtException.bind(this));
14
19
  process.env.TZ = "Asia/Shanghai";
15
20
  EventTool_1.GEventTool.on("socket_server_init_done", this.onStart.bind(this));
21
+ let argv = process.argv || [];
22
+ for (let i = 0; i < argv.length; ++i) {
23
+ let arg = argv[i].toLowerCase();
24
+ if (arg == "-d" || arg == "-debug") {
25
+ Config_1.Config.debug = true;
26
+ this._debug = true;
27
+ }
28
+ }
16
29
  }
17
30
  onStart() {
18
31
  let events = this._events["start"] || [];
@@ -2,6 +2,10 @@ export declare class Config {
2
2
  protected _suffix: string;
3
3
  protected _is_init: boolean;
4
4
  protected _file_name: string;
5
+ /**
6
+ * 是否是debug调试模式,主要区别于读取数据档,debug默认读取file_d文件,release默认读取file_r文件,如果不存在都会读取file文件
7
+ */
8
+ static debug: boolean;
5
9
  constructor(filename: any);
6
10
  init(): boolean;
7
11
  }
@@ -43,10 +43,6 @@ export declare class WebServerConfig {
43
43
  export declare let GFCfg: FrameworkConfig;
44
44
  export declare class FrameworkConfig extends ServerConfig {
45
45
  console_level: number;
46
- /**
47
- * 是否是debug调试模式,主要区别于读取数据档,debug默认读取file_d文件,release默认读取file_r文件,如果不存在都会读取file文件
48
- */
49
- debug: boolean;
50
46
  log: {
51
47
  appenders: {
52
48
  console: {
@@ -114,7 +114,7 @@ declare class MongoManager {
114
114
  id: number;
115
115
  des: string;
116
116
  };
117
- rs: mongo.UpdateResult | mongo.Document;
117
+ rs: mongo.Document | mongo.UpdateResult;
118
118
  }>;
119
119
  createIndex(collection: string, index: any, callback?: mongo.CreateIndexesOptions): Promise<{
120
120
  errcode: {
@@ -2,6 +2,8 @@ declare class CgServer {
2
2
  protected _events: {
3
3
  [name: string]: Function[];
4
4
  };
5
+ protected _debug: boolean;
6
+ get debug(): boolean;
5
7
  constructor();
6
8
  init(): void;
7
9
  onStart(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cgserver",
3
- "version": "6.5.7",
3
+ "version": "6.5.8",
4
4
  "author": "trojan",
5
5
  "type": "commonjs",
6
6
  "description": "free for all.Websocket or Http",