@wutiange/log-listener-plugin 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +3 -3
- package/package.json +3 -2
- package/dist/index.d.ts +0 -16
- package/dist/index.js.map +0 -1
- package/dist/server.d.ts +0 -10
- package/dist/server.js +0 -45
- package/dist/server.js.map +0 -1
package/dist/index.js
CHANGED
@@ -45,13 +45,13 @@ class Logger {
|
|
45
45
|
this.server.log(sendData);
|
46
46
|
}
|
47
47
|
log(...data) {
|
48
|
-
this._log('log', data);
|
48
|
+
this._log('log', ...data);
|
49
49
|
}
|
50
50
|
warn(...data) {
|
51
|
-
this._log('warn', data);
|
51
|
+
this._log('warn', ...data);
|
52
52
|
}
|
53
53
|
error(...data) {
|
54
|
-
this._log('error', data);
|
54
|
+
this._log('error', ...data);
|
55
55
|
}
|
56
56
|
req(input, init) {
|
57
57
|
var _a;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wutiange/log-listener-plugin",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.4",
|
4
4
|
"description": "这是log-record的插件,如果需要使用这个日志监听,那么就需要把这个插件安装到项目中",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"types": "dist/index.d.ts",
|
@@ -10,7 +10,8 @@
|
|
10
10
|
"private": false,
|
11
11
|
"scripts": {
|
12
12
|
"build": "tsc",
|
13
|
-
"dev": "ts-node ./src/index.ts"
|
13
|
+
"dev": "ts-node ./src/index.ts",
|
14
|
+
"publish": "tsc"
|
14
15
|
},
|
15
16
|
"devDependencies": {
|
16
17
|
"ts-node": "^10.9.2",
|
package/dist/index.d.ts
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
declare class Logger {
|
2
|
-
private server;
|
3
|
-
private baseData;
|
4
|
-
setBaseUrl(url: string): void;
|
5
|
-
setBaseData(data: Record<string, any>): void;
|
6
|
-
private throwNotSetBaseUrl;
|
7
|
-
private throwNotSetBaseData;
|
8
|
-
private _log;
|
9
|
-
log(...data: any[]): void;
|
10
|
-
warn(...data: any[]): void;
|
11
|
-
error(...data: any[]): void;
|
12
|
-
req(input: RequestInfo | URL, init?: RequestInit): Promise<string>;
|
13
|
-
res(id: number, response?: Response, isTimeout?: boolean): Promise<string>;
|
14
|
-
}
|
15
|
-
declare const _default: Logger;
|
16
|
-
export default _default;
|
package/dist/index.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,sDAA6B;AAG7B,MAAM,MAAM;IAAZ;QAEU,WAAM,GAAkB,IAAI,CAAA;IA0EtC,CAAC;IAvEC,UAAU,CAAC,GAAW;QACpB,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;QAC5B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,MAAM,GAAG,IAAI,gBAAM,CAAC,GAAG,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC;IAED,WAAW,CAAC,IAAyB;QACnC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;IACtB,CAAC;IAEO,kBAAkB;QACxB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;QAClE,CAAC;IACH,CAAC;IAEO,mBAAmB;QACzB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;QAC5C,CAAC;IACH,CAAC;IAEO,IAAI,CAAC,KAAa,EAAE,GAAG,IAAW;QACxC,IAAI,CAAC,kBAAkB,EAAE,CAAA;QACzB,IAAI,CAAC,mBAAmB,EAAE,CAAA;QAC1B,MAAM,QAAQ,mCACT,IAAI,CAAC,QAAQ,KAChB,OAAO,EAAE,IAAI,EACb,KAAK,EAAE,KAAK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,EAC5B,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,EACnB,SAAS,IACT,CAAA;QACJ,CAAC;KAAA;CACF;AAGD,kBAAe,IAAI,MAAM,EAAE,CAAA"}
|
package/dist/server.d.ts
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
declare class Server {
|
2
|
-
private baseUrl;
|
3
|
-
private port;
|
4
|
-
constructor(url: string);
|
5
|
-
private send;
|
6
|
-
updateUrl(url: string): void;
|
7
|
-
log(data: Record<string, any>): Promise<string>;
|
8
|
-
network(data: Record<string, any>): Promise<string>;
|
9
|
-
}
|
10
|
-
export default Server;
|
package/dist/server.js
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
class Server {
|
13
|
-
constructor(url) {
|
14
|
-
this.baseUrl = '';
|
15
|
-
this.port = 27751;
|
16
|
-
this.updateUrl(url);
|
17
|
-
}
|
18
|
-
send(path, data) {
|
19
|
-
return __awaiter(this, void 0, void 0, function* () {
|
20
|
-
const result = yield fetch(`${this.baseUrl}:${this.port}/${path}`, {
|
21
|
-
method: 'POST',
|
22
|
-
headers: {
|
23
|
-
'Content-Type': 'application/json;charset:utf-8'
|
24
|
-
},
|
25
|
-
body: JSON.stringify(data)
|
26
|
-
});
|
27
|
-
return result.text();
|
28
|
-
});
|
29
|
-
}
|
30
|
-
updateUrl(url) {
|
31
|
-
this.baseUrl = url;
|
32
|
-
}
|
33
|
-
log(data) {
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
35
|
-
return this.send("log", data);
|
36
|
-
});
|
37
|
-
}
|
38
|
-
network(data) {
|
39
|
-
return __awaiter(this, void 0, void 0, function* () {
|
40
|
-
return this.send("network", data);
|
41
|
-
});
|
42
|
-
}
|
43
|
-
}
|
44
|
-
exports.default = Server;
|
45
|
-
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAAM,MAAM;IAGV,YAAY,GAAW;QAFf,YAAO,GAAG,EAAE,CAAC;QACb,SAAI,GAAG,KAAK,CAAA;QAElB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;IACrB,CAAC;IAEa,IAAI,CAAC,IAAY,EAAE,IAAyB;;YACxD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,EAAE;gBACjE,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,cAAc,EAAE,gCAAgC;iBACjD;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;aAC3B,CAAC,CAAA;YACF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;QACtB,CAAC;KAAA;IAED,SAAS,CAAC,GAAW;QACnB,IAAI,CAAC,OAAO,GAAG,GAAG,CAAA;IACpB,CAAC;IAEK,GAAG,CAAC,IAAyB;;YACjC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAC/B,CAAC;KAAA;IAEK,OAAO,CAAC,IAAyB;;YACrC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;QACnC,CAAC;KAAA;CACF;AAED,kBAAe,MAAM,CAAA"}
|