@midwayjs/faas 3.15.2 → 3.15.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.
@@ -1,8 +1,18 @@
1
- export declare const midwayLogger: {
2
- default: {
3
- enableFile: boolean;
4
- enableError: boolean;
5
- format: (info: any) => string;
1
+ import { MidwayAppInfo } from '@midwayjs/core';
2
+ declare const _default: (appInfo: MidwayAppInfo) => {
3
+ midwayLogger: {
4
+ default: {
5
+ enableConsole: boolean;
6
+ enableFile: boolean;
7
+ enableError: boolean;
8
+ transports: {
9
+ console: {
10
+ autoColors: boolean;
11
+ };
12
+ };
13
+ format: (info: any) => string;
14
+ };
6
15
  };
7
16
  };
17
+ export default _default;
8
18
  //# sourceMappingURL=config.default.d.ts.map
@@ -1,15 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.midwayLogger = void 0;
4
- exports.midwayLogger = {
5
- default: {
6
- enableFile: false,
7
- enableError: false,
8
- format: (info) => {
9
- var _a, _b, _c, _d, _e, _f;
10
- const requestId = (_f = (_c = (_b = (_a = info.ctx) === null || _a === void 0 ? void 0 : _a['originContext']) === null || _b === void 0 ? void 0 : _b['requestId']) !== null && _c !== void 0 ? _c : (_e = (_d = info.ctx) === null || _d === void 0 ? void 0 : _d['originContext']) === null || _e === void 0 ? void 0 : _e['request_id']) !== null && _f !== void 0 ? _f : '';
11
- return `${new Date().toISOString()} ${requestId} [${info.level}] ${info.message}`;
3
+ const isDevelopmentEnvironment = env => {
4
+ return ['local', 'test', 'unittest'].includes(env);
5
+ };
6
+ exports.default = (appInfo) => ({
7
+ midwayLogger: {
8
+ default: {
9
+ // for logger v2
10
+ enableConsole: true,
11
+ enableFile: false,
12
+ enableError: false,
13
+ transports: {
14
+ // for logger v3
15
+ console: {
16
+ autoColors: isDevelopmentEnvironment(appInfo.env),
17
+ },
18
+ },
19
+ format: (info) => {
20
+ var _a, _b, _c, _d, _e, _f;
21
+ const requestId = (_f = (_c = (_b = (_a = info.ctx) === null || _a === void 0 ? void 0 : _a['originContext']) === null || _b === void 0 ? void 0 : _b['requestId']) !== null && _c !== void 0 ? _c : (_e = (_d = info.ctx) === null || _d === void 0 ? void 0 : _d['originContext']) === null || _e === void 0 ? void 0 : _e['request_id']) !== null && _f !== void 0 ? _f : '';
22
+ return `${new Date().toISOString()} ${requestId} [${info.level}] ${info.message}`;
23
+ },
12
24
  },
13
25
  },
14
- };
26
+ });
15
27
  //# sourceMappingURL=config.default.js.map
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@midwayjs/faas",
3
- "version": "3.15.2",
3
+ "version": "3.15.6",
4
4
  "main": "dist/index.js",
5
5
  "typings": "index.d.ts",
6
6
  "dependencies": {
7
- "@midwayjs/core": "^3.15.0",
7
+ "@midwayjs/core": "^3.15.6",
8
8
  "@midwayjs/serverless-http-parser": "^3.14.0",
9
9
  "@midwayjs/simple-lock": "^1.1.4"
10
10
  },
11
11
  "devDependencies": {
12
12
  "@midwayjs/logger": "^3.0.0",
13
- "@midwayjs/mock": "^3.15.2",
14
- "@midwayjs/serverless-fc-starter": "^3.15.0",
13
+ "@midwayjs/mock": "^3.15.6",
14
+ "@midwayjs/serverless-fc-starter": "^3.15.6",
15
15
  "@midwayjs/serverless-scf-starter": "^3.14.0",
16
16
  "mm": "3.4.0"
17
17
  },
@@ -44,5 +44,5 @@
44
44
  "url": "git@github.com:midwayjs/midway.git"
45
45
  },
46
46
  "license": "MIT",
47
- "gitHead": "e8b53689c50aa8c9a691de7d985cafd62f5f70e7"
47
+ "gitHead": "b04e58d015b8f4ffb48c98ad72180d88c70011e5"
48
48
  }