vona-core 5.0.83 → 5.0.85

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.
@@ -3,5 +3,5 @@ import type { VonaApplication } from '../core/application.ts';
3
3
  export declare class BeanSimple {
4
4
  protected app: VonaApplication;
5
5
  protected get ctx(): VonaContext;
6
- protected get bean(): import("vona").BeanContainer;
6
+ protected get bean(): import("./beanContainer.ts").BeanContainer;
7
7
  }
@@ -1,3 +1,4 @@
1
+ import { catchErrorSync } from '@cabloy/utils';
1
2
  import fse from 'fs-extra';
2
3
  import * as Winston from 'winston';
3
4
  import DailyRotateFile from 'winston-daily-rotate-file';
@@ -78,8 +79,13 @@ export class AppLogger extends BeanSimple {
78
79
  createTransportFile(fileName, clientInfo, options) {
79
80
  const dirname = this.app.config.server.loggerDir;
80
81
  if (!fse.existsSync(dirname)) {
81
- console.error(`========== Logger dir not exists: ${dirname} ==========`);
82
- return;
82
+ const [_, err] = catchErrorSync(() => {
83
+ fse.ensureDirSync(dirname);
84
+ });
85
+ if (err) {
86
+ console.error(`========== Logger dir not exists: ${dirname} ==========`);
87
+ return;
88
+ }
83
89
  }
84
90
  const configRotate = this.app.config.logger.rotate;
85
91
  let optionsFile;
@@ -1,5 +1,5 @@
1
- import type { PowerPartial } from 'vona';
2
1
  import type { VonaAppInfo } from '../../../types/application/app.ts';
3
2
  import type { ConfigLogger } from '../../../types/interface/logger.ts';
4
3
  import type { VonaConfigEnv } from '../../../types/utils/env.ts';
4
+ import type { PowerPartial } from '../../../types/utils/powerPartial.ts';
5
5
  export declare function combineLoggerDefault(_appInfo: VonaAppInfo, env: VonaConfigEnv): PowerPartial<ConfigLogger>;
@@ -1,9 +1,9 @@
1
1
  import { isEmptyObject } from '@cabloy/utils';
2
2
  import chalk from 'chalk';
3
3
  import { LEVEL, MESSAGE } from 'triple-beam';
4
- import { useApp } from 'vona';
5
4
  import * as Winston from 'winston';
6
5
  import { cast } from "../../../types/utils/cast.js";
6
+ import { useApp } from "../../framework/useApp.js";
7
7
  const SymbolLoggerMessage = Symbol('SymbolLoggerMessage');
8
8
  export const formatLoggerAxiosError = Winston.format((einfo, { stack, cause }) => {
9
9
  if ((einfo instanceof Error && einfo.constructor.name.includes('AxiosError')) || einfo.name === 'AxiosError') {
@@ -1,3 +1,4 @@
1
+ import { catchErrorSync } from '@cabloy/utils';
1
2
  import { closeApp, useApp } from "./useApp.js";
2
3
  export function handleProcessWork() {
3
4
  process.once('SIGUSR2', async () => {
@@ -15,8 +16,15 @@ export function handleProcessWork() {
15
16
  process.kill(process.pid, 'SIGTERM');
16
17
  }
17
18
  else {
18
- const logger = app.meta.logger.get();
19
- logger.error(err);
19
+ const [logger] = catchErrorSync(() => {
20
+ return app.meta.logger.get();
21
+ });
22
+ if (logger) {
23
+ logger.error(err);
24
+ }
25
+ else {
26
+ console.error(err);
27
+ }
20
28
  if (!app.meta.appStarted) {
21
29
  await app.meta.logger.dispose();
22
30
  process.kill(process.pid, 'SIGTERM');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-core",
3
3
  "type": "module",
4
- "version": "5.0.83",
4
+ "version": "5.0.85",
5
5
  "description": "vona",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -32,7 +32,7 @@
32
32
  "@cabloy/module-info": "^1.3.31",
33
33
  "@cabloy/module-info-pro": "^1.0.39",
34
34
  "@cabloy/set": "^1.0.17",
35
- "@cabloy/utils": "^1.0.46",
35
+ "@cabloy/utils": "^1.0.47",
36
36
  "@cabloy/word-utils": "^2.0.1",
37
37
  "@cabloy/zod-errors-custom": "^2.0.3",
38
38
  "@cabloy/zod-openapi": "^1.0.3",