vona-cli-set-api 1.0.329 → 1.0.331

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.
@@ -46,7 +46,7 @@
46
46
  }
47
47
  },
48
48
  "dependencies": {
49
- "vona": "^5.0.192"
49
+ "vona": "^5.0.193"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@cabloy/lint": "^5.0.16",
@@ -1,5 +1,8 @@
1
- import type { VonaAppInfo, VonaConfigEnv, VonaConfigOptional } from 'vona';
1
+ import type { ILoggerOptionsClientInfo, VonaAppInfo, VonaApplication, VonaConfigEnv, VonaConfigOptional } from 'vona';
2
2
  import type { IDatabaseClientRecord } from 'vona-module-a-orm';
3
+ import type * as Winston from 'winston';
4
+ import { replaceTemplate } from '@cabloy/utils';
5
+ import { formatLoggerAxiosError, formatLoggerCtx } from 'vona';
3
6
 
4
7
  declare module 'vona' {
5
8
  export interface IInstanceRecord {
@@ -17,9 +20,37 @@ declare module 'vona-module-a-orm' {
17
20
  export default function (_appInfo: VonaAppInfo, env: VonaConfigEnv) {
18
21
  const config = {} as VonaConfigOptional;
19
22
 
23
+ // logger
24
+ config.logger = {
25
+ rotate: {
26
+ enable: env.LOGGER_ROTATE_ENABLE === 'true',
27
+ options(filename: string) {
28
+ return {
29
+ filename: replaceTemplate(env.LOGGER_ROTATE_FILENAME!, { filename }),
30
+ datePattern: env.LOGGER_ROTATE_DATEPATTERN,
31
+ maxSize: env.LOGGER_ROTATE_MAXSIZE,
32
+ maxFiles: env.LOGGER_ROTATE_MAXFILES,
33
+ };
34
+ },
35
+ },
36
+ base(this: VonaApplication, _clientInfo: ILoggerOptionsClientInfo, winston: typeof Winston) {
37
+ return {
38
+ format: winston.format.combine(
39
+ formatLoggerAxiosError({ stack: true }),
40
+ formatLoggerCtx(),
41
+ winston.format.errors({ stack: true }),
42
+ winston.format.splat(),
43
+ winston.format.timestamp(),
44
+ ),
45
+ transports: undefined,
46
+ };
47
+ },
48
+ clients: {},
49
+ };
50
+
20
51
  // redis
21
52
  config.redis = {
22
- default: {
53
+ base: {
23
54
  host: env.REDIS_DEFAULT_HOST,
24
55
  port: Number.parseInt(env.REDIS_DEFAULT_PORT!),
25
56
  password: env.REDIS_DEFAULT_PASSWORD,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-cli-set-api",
3
3
  "type": "module",
4
- "version": "1.0.329",
4
+ "version": "1.0.331",
5
5
  "description": "vona cli-set-api",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -61,7 +61,7 @@
61
61
  "ts-node-maintained": "^10.9.6",
62
62
  "urllib": "^4.6.11",
63
63
  "uuid": "^11.1.0",
64
- "vona-core": "^5.0.87",
64
+ "vona-core": "^5.0.88",
65
65
  "why-is-node-running": "^3.2.2",
66
66
  "yargs-parser": "^21.1.1"
67
67
  },