@midwayjs/bootstrap 3.12.5 → 3.13.5

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.
@@ -1,5 +1,5 @@
1
1
  import { IMidwayBootstrapOptions, IMidwayContainer } from '@midwayjs/core';
2
- import { IMidwayLogger } from '@midwayjs/logger';
2
+ import { ILogger } from '@midwayjs/logger';
3
3
  export declare class BootstrapStarter {
4
4
  protected appDir: string;
5
5
  protected baseDir: string;
@@ -16,8 +16,9 @@ export declare class BootstrapStarter {
16
16
  }
17
17
  export declare class Bootstrap {
18
18
  protected static starter: BootstrapStarter;
19
- protected static logger: IMidwayLogger;
19
+ protected static logger: ILogger;
20
20
  protected static configured: boolean;
21
+ protected static bootstrapLoggerFactory: import("@midwayjs/logger").LoggerFactory;
21
22
  /**
22
23
  * set global configuration for midway
23
24
  * @param configuration
package/dist/bootstrap.js CHANGED
@@ -41,6 +41,7 @@ class BootstrapStarter {
41
41
  }
42
42
  this.applicationContext = await (0, core_1.initializeGlobalApplicationContext)({
43
43
  asyncContextManager: (0, async_hooks_context_manager_1.createContextManager)(),
44
+ loggerFactory: logger_1.loggers,
44
45
  ...this.globalOptions,
45
46
  });
46
47
  return this.applicationContext;
@@ -55,6 +56,11 @@ class BootstrapStarter {
55
56
  (0, sticky_1.setupWorker)(io);
56
57
  }
57
58
  }
59
+ const frameworkService = this.applicationContext.get(core_1.MidwayFrameworkService);
60
+ // check main framework
61
+ if (!frameworkService.getMainApp()) {
62
+ throw new core_1.MidwayMainFrameworkMissingError();
63
+ }
58
64
  }
59
65
  async stop() {
60
66
  if (this.applicationContext) {
@@ -86,15 +92,22 @@ class Bootstrap {
86
92
  * @param configuration
87
93
  */
88
94
  static configure(configuration = {}) {
89
- var _a;
90
95
  this.configured = true;
91
96
  if (!this.logger && !configuration.logger) {
92
- this.logger = new logger_1.MidwayBaseLogger({
93
- disableError: true,
94
- disableFile: true,
97
+ this.logger = this.bootstrapLoggerFactory.createLogger('bootstrap', {
98
+ enableError: false,
99
+ enableFile: false,
100
+ enableConsole: true,
95
101
  });
96
102
  if (configuration.logger === false) {
97
- (_a = this.logger) === null || _a === void 0 ? void 0 : _a['disableConsole']();
103
+ if (this.logger['disableConsole']) {
104
+ // v2
105
+ this.logger['disableConsole']();
106
+ }
107
+ else {
108
+ // v3
109
+ this.logger['level'] = 'none';
110
+ }
98
111
  }
99
112
  configuration.logger = this.logger;
100
113
  }
@@ -153,7 +166,7 @@ class Bootstrap {
153
166
  static reset() {
154
167
  this.configured = false;
155
168
  this.starter = null;
156
- this.logger.close();
169
+ this.bootstrapLoggerFactory.close();
157
170
  }
158
171
  /**
159
172
  * on bootstrap receive a exit signal
@@ -212,4 +225,5 @@ class Bootstrap {
212
225
  }
213
226
  exports.Bootstrap = Bootstrap;
214
227
  Bootstrap.configured = false;
228
+ Bootstrap.bootstrapLoggerFactory = new logger_1.MidwayLoggerContainer();
215
229
  //# sourceMappingURL=bootstrap.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/bootstrap",
3
- "version": "3.12.5",
3
+ "version": "3.13.5",
4
4
  "description": "midwayjs bootstrap",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -21,12 +21,12 @@
21
21
  ],
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@midwayjs/async-hooks-context-manager": "^3.12.3",
24
+ "@midwayjs/async-hooks-context-manager": "^3.13.5",
25
25
  "@midwayjs/event-bus": "1.9.4"
26
26
  },
27
27
  "devDependencies": {
28
- "@midwayjs/core": "^3.12.3",
29
- "@midwayjs/logger": "^2.15.0",
28
+ "@midwayjs/core": "^3.13.5",
29
+ "@midwayjs/logger": "^3.0.0",
30
30
  "request": "2.88.2",
31
31
  "socket.io-client": "4.7.2"
32
32
  },
@@ -38,5 +38,5 @@
38
38
  "engines": {
39
39
  "node": ">=12.11.0"
40
40
  },
41
- "gitHead": "24c6b9f7a3be1bf37b3182286f3e55fc418a2c99"
41
+ "gitHead": "e78cb2cb969f0bfe9bab2d4dc9a5332b178a3b4d"
42
42
  }