@fastcar/core 0.3.2 → 0.3.4
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/package.json +1 -1
- package/src/annotation/Application.ts +2 -2
- package/src/annotation/bind/DemandInjection.ts +3 -2
- package/target/annotation/Application.js +2 -2
- package/target/annotation/bind/DemandInjection.js +3 -2
- package/test/example/logs/fastcar-server.logger.log +3 -0
- package/test/example/logs/fastcar-server.sys5.log +5 -0
- package/test/example/logs/sys.log +0 -0
- package/test/example/logs/sys1.log +0 -0
package/package.json
CHANGED
|
@@ -5,11 +5,11 @@ import TypeUtil from "../utils/TypeUtil";
|
|
|
5
5
|
//基础服务的应用
|
|
6
6
|
export default function Application(target: any) {
|
|
7
7
|
return new Proxy(target, {
|
|
8
|
-
construct: (target: ClassConstructor<Object>, args: any) => {
|
|
8
|
+
construct: (target: ClassConstructor<Object>, args: any, newTarget?: any) => {
|
|
9
9
|
const FastCarApplication = require("../FastCarApplication").default;
|
|
10
10
|
|
|
11
11
|
let app = new FastCarApplication();
|
|
12
|
-
let appProxy =
|
|
12
|
+
let appProxy = Reflect.construct(target, args, newTarget);
|
|
13
13
|
Reflect.set(appProxy, "app", app);
|
|
14
14
|
|
|
15
15
|
let keys = ClassUtils.getProtoType(target);
|
|
@@ -4,11 +4,12 @@ import { ClassConstructor } from "../../type/ClassConstructor";
|
|
|
4
4
|
|
|
5
5
|
export default function DemandInjection(Target: ClassConstructor<any>) {
|
|
6
6
|
return new Proxy(Target, {
|
|
7
|
-
construct: (Target: ClassConstructor<any>, args: any) => {
|
|
8
|
-
let c =
|
|
7
|
+
construct: (Target: ClassConstructor<any>, args: any, newTarget?: any) => {
|
|
8
|
+
let c = Reflect.construct(Target, args, newTarget);
|
|
9
9
|
let app: any = Reflect.get(global, CommonConstant.FastcarApp);
|
|
10
10
|
|
|
11
11
|
app?.loadInjectionService(c);
|
|
12
|
+
app?.loadLoggerIOC(c);
|
|
12
13
|
return c;
|
|
13
14
|
},
|
|
14
15
|
});
|
|
@@ -6,10 +6,10 @@ const TypeUtil_1 = require("../utils/TypeUtil");
|
|
|
6
6
|
//基础服务的应用
|
|
7
7
|
function Application(target) {
|
|
8
8
|
return new Proxy(target, {
|
|
9
|
-
construct: (target, args) => {
|
|
9
|
+
construct: (target, args, newTarget) => {
|
|
10
10
|
const FastCarApplication = require("../FastCarApplication").default;
|
|
11
11
|
let app = new FastCarApplication();
|
|
12
|
-
let appProxy =
|
|
12
|
+
let appProxy = Reflect.construct(target, args, newTarget);
|
|
13
13
|
Reflect.set(appProxy, "app", app);
|
|
14
14
|
let keys = ClassUtils_1.default.getProtoType(target);
|
|
15
15
|
for (let key of keys) {
|
|
@@ -5,10 +5,11 @@ exports.default = DemandInjection;
|
|
|
5
5
|
const CommonConstant_1 = require("../../constant/CommonConstant");
|
|
6
6
|
function DemandInjection(Target) {
|
|
7
7
|
return new Proxy(Target, {
|
|
8
|
-
construct: (Target, args) => {
|
|
9
|
-
let c =
|
|
8
|
+
construct: (Target, args, newTarget) => {
|
|
9
|
+
let c = Reflect.construct(Target, args, newTarget);
|
|
10
10
|
let app = Reflect.get(global, CommonConstant_1.CommonConstant.FastcarApp);
|
|
11
11
|
app?.loadInjectionService(c);
|
|
12
|
+
app?.loadLoggerIOC(c);
|
|
12
13
|
return c;
|
|
13
14
|
},
|
|
14
15
|
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
{"timestamp":"2024-12-10 12:19:26.805","level":"INFO","label":"fastcar-server.logger","message":"自定义的日志输出"}
|
|
2
|
+
{"timestamp":"2024-12-10 12:19:26.806","level":"WARN","label":"fastcar-server.logger","message":"自定义警告"}
|
|
3
|
+
{"timestamp":"2024-12-10 12:19:26.806","level":"ERROR","label":"fastcar-server.logger","message":"自定义报错"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
{"timestamp":"2024-12-10 12:19:26.598","level":"INFO","label":"fastcar-server.sys","message":"Start scanning component"}
|
|
2
|
+
{"timestamp":"2024-12-10 12:19:26.795","level":"INFO","label":"fastcar-server.sys","message":"Complete component scan"}
|
|
3
|
+
{"timestamp":"2024-12-10 12:19:26.796","level":"INFO","label":"fastcar-server.sys","message":"Call application initialization method"}
|
|
4
|
+
{"timestamp":"2024-12-10 12:19:26.798","level":"INFO","label":"fastcar-server.sys","message":"start server app is run"}
|
|
5
|
+
{"timestamp":"2024-12-10 12:19:26.799","level":"INFO","label":"fastcar-server.sys","message":"version 1.0.0"}
|
|
File without changes
|
|
File without changes
|