@midwayjs/web 4.0.0-alpha.1 → 4.0.0-beta.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.
package/README.md CHANGED
@@ -9,4 +9,4 @@ Document: [https://midwayjs.org](https://midwayjs.org)
9
9
 
10
10
  ## License
11
11
 
12
- [MIT]((http://github.com/midwayjs/midway/blob/master/LICENSE))
12
+ [MIT]((https://github.com/midwayjs/midway/blob/master/LICENSE))
package/dist/cluster.js CHANGED
@@ -23,7 +23,7 @@ else {
23
23
  (0, core_1.prepareGlobalApplicationContext)({
24
24
  appDir,
25
25
  baseDir,
26
- ignore: ['**/app/extend/**', '**/app/public/**'],
26
+ // ignore: ['**/app/extend/**', '**/app/public/**'],
27
27
  });
28
28
  if (!isAgent) {
29
29
  debug('[egg]: run with egg-scripts in worker and init midway container complete');
@@ -15,6 +15,25 @@ exports.default = appInfo => {
15
15
  appLogger: {
16
16
  fileLogName: 'midway-web.log',
17
17
  aliasName: 'logger',
18
+ contextFormat: info => {
19
+ const ctx = info.ctx;
20
+ // format: '[$userId/$ip/$traceId/$use_ms $method $url]'
21
+ const userId = ctx.userId || '-';
22
+ const traceId = ctx.traceId ?? ctx.tracer?.traceId ?? '-';
23
+ const use = Date.now() - ctx.startTime;
24
+ const label = userId +
25
+ '/' +
26
+ ctx.ip +
27
+ '/' +
28
+ traceId +
29
+ '/' +
30
+ use +
31
+ 'ms ' +
32
+ ctx.method +
33
+ ' ' +
34
+ ctx.url;
35
+ return `${info.timestamp} ${info.LEVEL} ${info.pid} [${label}] ${info.message}`;
36
+ },
18
37
  },
19
38
  agentLogger: {
20
39
  fileLogName: 'midway-agent.log',
@@ -23,25 +42,6 @@ exports.default = appInfo => {
23
42
  });
24
43
  exports.egg = {
25
44
  dumpConfig: true,
26
- contextLoggerFormat: info => {
27
- const ctx = info.ctx;
28
- // format: '[$userId/$ip/$traceId/$use_ms $method $url]'
29
- const userId = ctx.userId || '-';
30
- const traceId = ctx.traceId ?? ctx.tracer?.traceId ?? '-';
31
- const use = Date.now() - ctx.startTime;
32
- const label = userId +
33
- '/' +
34
- ctx.ip +
35
- '/' +
36
- traceId +
37
- '/' +
38
- use +
39
- 'ms ' +
40
- ctx.method +
41
- ' ' +
42
- ctx.url;
43
- return `${info.timestamp} ${info.LEVEL} ${info.pid} [${label}] ${info.message}`;
44
- },
45
45
  queryParseMode: 'extended',
46
46
  };
47
47
  exports.pluginOverwrite = false;
@@ -173,9 +173,9 @@ let MidwayWebFramework = class MidwayWebFramework extends core_1.BaseFramework {
173
173
  };
174
174
  // https config
175
175
  if (serverOptions.key && serverOptions.cert) {
176
- serverOptions.key = core_1.PathFileUtil.getFileContentSync(serverOptions.key);
177
- serverOptions.cert = core_1.PathFileUtil.getFileContentSync(serverOptions.cert);
178
- serverOptions.ca = core_1.PathFileUtil.getFileContentSync(serverOptions.ca);
176
+ serverOptions.key = core_1.PathFileUtils.getFileContentSync(serverOptions.key);
177
+ serverOptions.cert = core_1.PathFileUtils.getFileContentSync(serverOptions.cert);
178
+ serverOptions.ca = core_1.PathFileUtils.getFileContentSync(serverOptions.ca);
179
179
  process.env.MIDWAY_HTTP_SSL = 'true';
180
180
  if (serverOptions.http2) {
181
181
  this.server = require('http2').createSecureServer(serverOptions, this.app.callback());
@@ -221,15 +221,15 @@ let MidwayWebFramework = class MidwayWebFramework extends core_1.BaseFramework {
221
221
  if (name) {
222
222
  return this.app.loggers[name] || logger_1.loggers.getLogger(name);
223
223
  }
224
- return this.appLogger;
224
+ return this.loggerService.getLogger(this.frameworkLoggerName);
225
225
  }
226
226
  setContextLoggerClass() {
227
227
  // eslint-disable-next-line @typescript-eslint/no-this-alias
228
- const self = this;
228
+ const contextFormat = this.configService.getConfiguration('midwayLogger.clients.appLogger.contextFormat');
229
229
  class MidwayEggContextLogger extends logger_1.MidwayContextLogger {
230
230
  constructor(ctx, appLogger) {
231
231
  super(ctx, appLogger, {
232
- contextFormat: self.contextLoggerFormat,
232
+ contextFormat,
233
233
  });
234
234
  }
235
235
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midwayjs/web",
3
- "version": "4.0.0-alpha.1",
3
+ "version": "4.0.0-beta.1",
4
4
  "description": "Midway Web Framework for Egg.js",
5
5
  "main": "dist/index.js",
6
6
  "typings": "index.d.ts",
@@ -29,16 +29,16 @@
29
29
  "license": "MIT",
30
30
  "devDependencies": {
31
31
  "@midwayjs/logger": "^3.0.0",
32
- "@midwayjs/mock": "^4.0.0-alpha.1",
32
+ "@midwayjs/mock": "^4.0.0-beta.1",
33
33
  "@types/koa": "2.15.0",
34
34
  "dayjs": "1.11.13",
35
- "egg-logger": "3.6.0",
35
+ "egg-logger": "3.6.1",
36
36
  "egg-mock": "4.2.1",
37
- "egg-scripts": "3.0.1",
37
+ "egg-scripts": "3.1.0",
38
38
  "egg-socket.io": "4.1.6",
39
39
  "egg-view-nunjucks": "2.3.0",
40
40
  "fake-egg": "1.0.0",
41
- "fs-extra": "11.2.0",
41
+ "fs-extra": "11.3.0",
42
42
  "is-type-of": "^2.1.0",
43
43
  "mm": "3.4.0",
44
44
  "mz-modules": "^2.1.0",
@@ -49,13 +49,13 @@
49
49
  },
50
50
  "dependencies": {
51
51
  "@eggjs/router": "^2.0.0",
52
- "@midwayjs/core": "^4.0.0-alpha.1",
52
+ "@midwayjs/core": "^4.0.0-beta.1",
53
53
  "egg": "^2.28.0",
54
54
  "egg-cluster": "^1.27.1",
55
55
  "egg-path-matching": "^2.1.0",
56
56
  "find-up": "5.0.0",
57
57
  "mkdirp": "1.0.4",
58
- "qs": "6.13.1"
58
+ "qs": "6.14.0"
59
59
  },
60
60
  "author": "Harry Chen <czy88840616@gmail.com>",
61
61
  "repository": {
@@ -65,5 +65,5 @@
65
65
  "engines": {
66
66
  "node": ">=12"
67
67
  },
68
- "gitHead": "14bb4da91805a1cf52f190c0d37a74b395dd6372"
68
+ "gitHead": "832961ec3aff123c033197d8c00cb2bc9bad7ff8"
69
69
  }