@twin.org/logging-rest-client 0.0.2-next.2 → 0.0.3-next.1
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/dist/es/index.js +4 -0
- package/dist/es/index.js.map +1 -0
- package/dist/{cjs/index.cjs → es/loggingRestClient.js} +19 -21
- package/dist/es/loggingRestClient.js.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/{loggingClient.d.ts → loggingRestClient.d.ts} +11 -6
- package/docs/changelog.md +33 -0
- package/docs/reference/classes/{LoggingClient.md → LoggingRestClient.md} +25 -11
- package/docs/reference/index.md +1 -1
- package/package.json +19 -9
- package/dist/esm/index.mjs +0 -63
package/dist/es/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,wBAAwB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./loggingRestClient.js\";\n"]}
|
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var apiCore = require('@twin.org/api-core');
|
|
4
|
-
var core = require('@twin.org/core');
|
|
5
|
-
|
|
6
1
|
// Copyright 2024 IOTA Stiftung.
|
|
7
2
|
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { BaseRestClient } from "@twin.org/api-core";
|
|
4
|
+
import { Coerce, Guards } from "@twin.org/core";
|
|
8
5
|
/**
|
|
9
6
|
* Client for performing logging through to REST endpoints.
|
|
10
7
|
*/
|
|
11
|
-
class
|
|
8
|
+
export class LoggingRestClient extends BaseRestClient {
|
|
12
9
|
/**
|
|
13
10
|
* Runtime name for the class.
|
|
14
|
-
* @internal
|
|
15
11
|
*/
|
|
16
|
-
static
|
|
12
|
+
static CLASS_NAME = "LoggingRestClient";
|
|
17
13
|
/**
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
CLASS_NAME = LoggingClient._CLASS_NAME;
|
|
21
|
-
/**
|
|
22
|
-
* Create a new instance of LoggingClient.
|
|
14
|
+
* Create a new instance of LoggingRestClient.
|
|
23
15
|
* @param config The configuration for the client.
|
|
24
16
|
*/
|
|
25
17
|
constructor(config) {
|
|
26
|
-
super(
|
|
18
|
+
super(LoggingRestClient.CLASS_NAME, config, "logging");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Returns the class name of the component.
|
|
22
|
+
* @returns The class name of the component.
|
|
23
|
+
*/
|
|
24
|
+
className() {
|
|
25
|
+
return LoggingRestClient.CLASS_NAME;
|
|
27
26
|
}
|
|
28
27
|
/**
|
|
29
28
|
* Log an entry to the connector.
|
|
@@ -31,7 +30,7 @@ class LoggingClient extends apiCore.BaseRestClient {
|
|
|
31
30
|
* @returns Nothing.
|
|
32
31
|
*/
|
|
33
32
|
async log(logEntry) {
|
|
34
|
-
|
|
33
|
+
Guards.object(LoggingRestClient.CLASS_NAME, "logEntry", logEntry);
|
|
35
34
|
await this.fetch("/", "POST", {
|
|
36
35
|
body: logEntry
|
|
37
36
|
});
|
|
@@ -42,12 +41,12 @@ class LoggingClient extends apiCore.BaseRestClient {
|
|
|
42
41
|
* @param source The source of the log entries.
|
|
43
42
|
* @param timeStart The inclusive time as the start of the log entries.
|
|
44
43
|
* @param timeEnd The inclusive time as the end of the log entries.
|
|
45
|
-
* @param cursor The cursor to request the next
|
|
46
|
-
* @param
|
|
44
|
+
* @param cursor The cursor to request the next chunk of entities.
|
|
45
|
+
* @param limit Limit the number of entities to return.
|
|
47
46
|
* @returns All the entities for the storage matching the conditions,
|
|
48
47
|
* and a cursor which can be used to request more entities.
|
|
49
48
|
*/
|
|
50
|
-
async query(level, source, timeStart, timeEnd, cursor,
|
|
49
|
+
async query(level, source, timeStart, timeEnd, cursor, limit) {
|
|
51
50
|
const response = await this.fetch("/", "GET", {
|
|
52
51
|
query: {
|
|
53
52
|
level,
|
|
@@ -55,11 +54,10 @@ class LoggingClient extends apiCore.BaseRestClient {
|
|
|
55
54
|
timeStart,
|
|
56
55
|
timeEnd,
|
|
57
56
|
cursor,
|
|
58
|
-
|
|
57
|
+
limit: Coerce.string(limit)
|
|
59
58
|
}
|
|
60
59
|
});
|
|
61
60
|
return response.body;
|
|
62
61
|
}
|
|
63
62
|
}
|
|
64
|
-
|
|
65
|
-
exports.LoggingClient = LoggingClient;
|
|
63
|
+
//# sourceMappingURL=loggingRestClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loggingRestClient.js","sourceRoot":"","sources":["../../src/loggingRestClient.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAWhD;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACpD;;OAEG;IACI,MAAM,CAAU,UAAU,uBAAuC;IAExE;;;OAGG;IACH,YAAY,MAA6B;QACxC,KAAK,CAAC,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;IAED;;;OAGG;IACI,SAAS;QACf,OAAO,iBAAiB,CAAC,UAAU,CAAC;IACrC,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,GAAG,CAAC,QAAmB;QACnC,MAAM,CAAC,MAAM,CAAY,iBAAiB,CAAC,UAAU,cAAoB,QAAQ,CAAC,CAAC;QAEnF,MAAM,IAAI,CAAC,KAAK,CAAqC,GAAG,EAAE,MAAM,EAAE;YACjE,IAAI,EAAE,QAAQ;SACd,CAAC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,KAAK,CACjB,KAAgB,EAChB,MAAe,EACf,SAAkB,EAClB,OAAgB,EAChB,MAAe,EACf,KAAc;QAWd,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,KAAK,CAA4C,GAAG,EAAE,KAAK,EAAE;YACxF,KAAK,EAAE;gBACN,KAAK;gBACL,MAAM;gBACN,SAAS;gBACT,OAAO;gBACP,MAAM;gBACN,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;aAC3B;SACD,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACtB,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { BaseRestClient } from \"@twin.org/api-core\";\nimport type { IBaseRestClientConfig, IOkResponse } from \"@twin.org/api-models\";\nimport { Coerce, Guards } from \"@twin.org/core\";\nimport type {\n\tILogEntry,\n\tILoggingComponent,\n\tILoggingCreateRequest,\n\tILoggingListRequest,\n\tILoggingListResponse,\n\tLogLevel\n} from \"@twin.org/logging-models\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Client for performing logging through to REST endpoints.\n */\nexport class LoggingRestClient extends BaseRestClient implements ILoggingComponent {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<LoggingRestClient>();\n\n\t/**\n\t * Create a new instance of LoggingRestClient.\n\t * @param config The configuration for the client.\n\t */\n\tconstructor(config: IBaseRestClientConfig) {\n\t\tsuper(LoggingRestClient.CLASS_NAME, config, \"logging\");\n\t}\n\n\t/**\n\t * Returns the class name of the component.\n\t * @returns The class name of the component.\n\t */\n\tpublic className(): string {\n\t\treturn LoggingRestClient.CLASS_NAME;\n\t}\n\n\t/**\n\t * Log an entry to the connector.\n\t * @param logEntry The entry to log.\n\t * @returns Nothing.\n\t */\n\tpublic async log(logEntry: ILogEntry): Promise<void> {\n\t\tGuards.object<ILogEntry>(LoggingRestClient.CLASS_NAME, nameof(logEntry), logEntry);\n\n\t\tawait this.fetch<ILoggingCreateRequest, IOkResponse>(\"/\", \"POST\", {\n\t\t\tbody: logEntry\n\t\t});\n\t}\n\n\t/**\n\t * Query the log entries.\n\t * @param level The level of the log entries.\n\t * @param source The source of the log entries.\n\t * @param timeStart The inclusive time as the start of the log entries.\n\t * @param timeEnd The inclusive time as the end of the log entries.\n\t * @param cursor The cursor to request the next chunk of entities.\n\t * @param limit Limit the number of entities to return.\n\t * @returns All the entities for the storage matching the conditions,\n\t * and a cursor which can be used to request more entities.\n\t */\n\tpublic async query(\n\t\tlevel?: LogLevel,\n\t\tsource?: string,\n\t\ttimeStart?: number,\n\t\ttimeEnd?: number,\n\t\tcursor?: string,\n\t\tlimit?: number\n\t): Promise<{\n\t\t/**\n\t\t * The entities, which can be partial if a limited keys list was provided.\n\t\t */\n\t\tentities: ILogEntry[];\n\t\t/**\n\t\t * An optional cursor, when defined can be used to call find to get more entities.\n\t\t */\n\t\tcursor?: string;\n\t}> {\n\t\tconst response = await this.fetch<ILoggingListRequest, ILoggingListResponse>(\"/\", \"GET\", {\n\t\t\tquery: {\n\t\t\t\tlevel,\n\t\t\t\tsource,\n\t\t\t\ttimeStart,\n\t\t\t\ttimeEnd,\n\t\t\t\tcursor,\n\t\t\t\tlimit: Coerce.string(limit)\n\t\t\t}\n\t\t});\n\n\t\treturn response.body;\n\t}\n}\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./
|
|
1
|
+
export * from "./loggingRestClient.js";
|
|
@@ -4,16 +4,21 @@ import type { ILogEntry, ILoggingComponent, LogLevel } from "@twin.org/logging-m
|
|
|
4
4
|
/**
|
|
5
5
|
* Client for performing logging through to REST endpoints.
|
|
6
6
|
*/
|
|
7
|
-
export declare class
|
|
7
|
+
export declare class LoggingRestClient extends BaseRestClient implements ILoggingComponent {
|
|
8
8
|
/**
|
|
9
9
|
* Runtime name for the class.
|
|
10
10
|
*/
|
|
11
|
-
readonly CLASS_NAME: string;
|
|
11
|
+
static readonly CLASS_NAME: string;
|
|
12
12
|
/**
|
|
13
|
-
* Create a new instance of
|
|
13
|
+
* Create a new instance of LoggingRestClient.
|
|
14
14
|
* @param config The configuration for the client.
|
|
15
15
|
*/
|
|
16
16
|
constructor(config: IBaseRestClientConfig);
|
|
17
|
+
/**
|
|
18
|
+
* Returns the class name of the component.
|
|
19
|
+
* @returns The class name of the component.
|
|
20
|
+
*/
|
|
21
|
+
className(): string;
|
|
17
22
|
/**
|
|
18
23
|
* Log an entry to the connector.
|
|
19
24
|
* @param logEntry The entry to log.
|
|
@@ -26,12 +31,12 @@ export declare class LoggingClient extends BaseRestClient implements ILoggingCom
|
|
|
26
31
|
* @param source The source of the log entries.
|
|
27
32
|
* @param timeStart The inclusive time as the start of the log entries.
|
|
28
33
|
* @param timeEnd The inclusive time as the end of the log entries.
|
|
29
|
-
* @param cursor The cursor to request the next
|
|
30
|
-
* @param
|
|
34
|
+
* @param cursor The cursor to request the next chunk of entities.
|
|
35
|
+
* @param limit Limit the number of entities to return.
|
|
31
36
|
* @returns All the entities for the storage matching the conditions,
|
|
32
37
|
* and a cursor which can be used to request more entities.
|
|
33
38
|
*/
|
|
34
|
-
query(level?: LogLevel, source?: string, timeStart?: number, timeEnd?: number, cursor?: string,
|
|
39
|
+
query(level?: LogLevel, source?: string, timeStart?: number, timeEnd?: number, cursor?: string, limit?: number): Promise<{
|
|
35
40
|
/**
|
|
36
41
|
* The entities, which can be partial if a limited keys list was provided.
|
|
37
42
|
*/
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @twin.org/logging-rest-client - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.1](https://github.com/twinfoundation/logging/compare/logging-rest-client-v0.0.3-next.0...logging-rest-client-v0.0.3-next.1) (2025-11-10)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add context id features ([#33](https://github.com/twinfoundation/logging/issues/33)) ([38e982c](https://github.com/twinfoundation/logging/commit/38e982c9f009019fc02b67d919444b52657c9021))
|
|
9
|
+
* add validate-locales ([df53f13](https://github.com/twinfoundation/logging/commit/df53f1331394f2f9333e91e4995a88dded90e484))
|
|
10
|
+
* eslint migration to flat config ([1f9fdde](https://github.com/twinfoundation/logging/commit/1f9fddedfdcce9942afed431d9460a0f22092744))
|
|
11
|
+
* update dependencies ([976fc06](https://github.com/twinfoundation/logging/commit/976fc06976c4899769486b7cb2e827c407d7fc89))
|
|
12
|
+
* update framework core ([aac823c](https://github.com/twinfoundation/logging/commit/aac823c2ead88843618b8a82b308d5a793411764))
|
|
13
|
+
* use shared store mechanism ([#20](https://github.com/twinfoundation/logging/issues/20)) ([bbacd31](https://github.com/twinfoundation/logging/commit/bbacd31af991d82d84294ad432a40830692880ca))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Dependencies
|
|
17
|
+
|
|
18
|
+
* The following workspace dependencies were updated
|
|
19
|
+
* dependencies
|
|
20
|
+
* @twin.org/logging-models bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
21
|
+
|
|
22
|
+
## [0.0.2-next.3](https://github.com/twinfoundation/logging/compare/logging-rest-client-v0.0.2-next.2...logging-rest-client-v0.0.2-next.3) (2025-10-09)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* add validate-locales ([df53f13](https://github.com/twinfoundation/logging/commit/df53f1331394f2f9333e91e4995a88dded90e484))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Dependencies
|
|
31
|
+
|
|
32
|
+
* The following workspace dependencies were updated
|
|
33
|
+
* dependencies
|
|
34
|
+
* @twin.org/logging-models bumped from 0.0.2-next.2 to 0.0.2-next.3
|
|
35
|
+
|
|
3
36
|
## [0.0.2-next.2](https://github.com/twinfoundation/logging/compare/logging-rest-client-v0.0.2-next.1...logging-rest-client-v0.0.2-next.2) (2025-08-29)
|
|
4
37
|
|
|
5
38
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Class:
|
|
1
|
+
# Class: LoggingRestClient
|
|
2
2
|
|
|
3
3
|
Client for performing logging through to REST endpoints.
|
|
4
4
|
|
|
@@ -14,9 +14,9 @@ Client for performing logging through to REST endpoints.
|
|
|
14
14
|
|
|
15
15
|
### Constructor
|
|
16
16
|
|
|
17
|
-
> **new
|
|
17
|
+
> **new LoggingRestClient**(`config`): `LoggingRestClient`
|
|
18
18
|
|
|
19
|
-
Create a new instance of
|
|
19
|
+
Create a new instance of LoggingRestClient.
|
|
20
20
|
|
|
21
21
|
#### Parameters
|
|
22
22
|
|
|
@@ -28,7 +28,7 @@ The configuration for the client.
|
|
|
28
28
|
|
|
29
29
|
#### Returns
|
|
30
30
|
|
|
31
|
-
`
|
|
31
|
+
`LoggingRestClient`
|
|
32
32
|
|
|
33
33
|
#### Overrides
|
|
34
34
|
|
|
@@ -38,15 +38,29 @@ The configuration for the client.
|
|
|
38
38
|
|
|
39
39
|
### CLASS\_NAME
|
|
40
40
|
|
|
41
|
-
> `readonly` **CLASS\_NAME**: `string`
|
|
41
|
+
> `readonly` `static` **CLASS\_NAME**: `string`
|
|
42
42
|
|
|
43
43
|
Runtime name for the class.
|
|
44
44
|
|
|
45
|
+
## Methods
|
|
46
|
+
|
|
47
|
+
### className()
|
|
48
|
+
|
|
49
|
+
> **className**(): `string`
|
|
50
|
+
|
|
51
|
+
Returns the class name of the component.
|
|
52
|
+
|
|
53
|
+
#### Returns
|
|
54
|
+
|
|
55
|
+
`string`
|
|
56
|
+
|
|
57
|
+
The class name of the component.
|
|
58
|
+
|
|
45
59
|
#### Implementation of
|
|
46
60
|
|
|
47
|
-
`ILoggingComponent.
|
|
61
|
+
`ILoggingComponent.className`
|
|
48
62
|
|
|
49
|
-
|
|
63
|
+
***
|
|
50
64
|
|
|
51
65
|
### log()
|
|
52
66
|
|
|
@@ -76,7 +90,7 @@ Nothing.
|
|
|
76
90
|
|
|
77
91
|
### query()
|
|
78
92
|
|
|
79
|
-
> **query**(`level?`, `source?`, `timeStart?`, `timeEnd?`, `cursor?`, `
|
|
93
|
+
> **query**(`level?`, `source?`, `timeStart?`, `timeEnd?`, `cursor?`, `limit?`): `Promise`\<\{ `entities`: `ILogEntry`[]; `cursor?`: `string`; \}\>
|
|
80
94
|
|
|
81
95
|
Query the log entries.
|
|
82
96
|
|
|
@@ -110,13 +124,13 @@ The inclusive time as the end of the log entries.
|
|
|
110
124
|
|
|
111
125
|
`string`
|
|
112
126
|
|
|
113
|
-
The cursor to request the next
|
|
127
|
+
The cursor to request the next chunk of entities.
|
|
114
128
|
|
|
115
|
-
#####
|
|
129
|
+
##### limit?
|
|
116
130
|
|
|
117
131
|
`number`
|
|
118
132
|
|
|
119
|
-
|
|
133
|
+
Limit the number of entities to return.
|
|
120
134
|
|
|
121
135
|
#### Returns
|
|
122
136
|
|
package/docs/reference/index.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/logging-rest-client",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-next.1",
|
|
4
4
|
"description": "Logging contract implementation which can connect to REST endpoints",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -18,25 +18,35 @@
|
|
|
18
18
|
"@twin.org/api-models": "next",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/entity": "next",
|
|
21
|
-
"@twin.org/logging-models": "0.0.
|
|
21
|
+
"@twin.org/logging-models": "0.0.3-next.1",
|
|
22
22
|
"@twin.org/nameof": "next"
|
|
23
23
|
},
|
|
24
|
-
"main": "./dist/
|
|
25
|
-
"module": "./dist/esm/index.mjs",
|
|
24
|
+
"main": "./dist/es/index.js",
|
|
26
25
|
"types": "./dist/types/index.d.ts",
|
|
27
26
|
"exports": {
|
|
28
27
|
".": {
|
|
29
28
|
"types": "./dist/types/index.d.ts",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
29
|
+
"import": "./dist/es/index.js",
|
|
30
|
+
"default": "./dist/es/index.js"
|
|
32
31
|
},
|
|
33
32
|
"./locales/*.json": "./locales/*.json"
|
|
34
33
|
},
|
|
35
34
|
"files": [
|
|
36
|
-
"dist/
|
|
37
|
-
"dist/esm",
|
|
35
|
+
"dist/es",
|
|
38
36
|
"dist/types",
|
|
39
37
|
"locales",
|
|
40
38
|
"docs"
|
|
41
|
-
]
|
|
39
|
+
],
|
|
40
|
+
"keywords": [
|
|
41
|
+
"twin",
|
|
42
|
+
"trade",
|
|
43
|
+
"iota",
|
|
44
|
+
"framework",
|
|
45
|
+
"blockchain",
|
|
46
|
+
"logging"
|
|
47
|
+
],
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "git+https://github.com/twinfoundation/logging/issues"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://twindev.org"
|
|
42
52
|
}
|
package/dist/esm/index.mjs
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { BaseRestClient } from '@twin.org/api-core';
|
|
2
|
-
import { Guards } from '@twin.org/core';
|
|
3
|
-
|
|
4
|
-
// Copyright 2024 IOTA Stiftung.
|
|
5
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
6
|
-
/**
|
|
7
|
-
* Client for performing logging through to REST endpoints.
|
|
8
|
-
*/
|
|
9
|
-
class LoggingClient extends BaseRestClient {
|
|
10
|
-
/**
|
|
11
|
-
* Runtime name for the class.
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
static _CLASS_NAME = "LoggingClient";
|
|
15
|
-
/**
|
|
16
|
-
* Runtime name for the class.
|
|
17
|
-
*/
|
|
18
|
-
CLASS_NAME = LoggingClient._CLASS_NAME;
|
|
19
|
-
/**
|
|
20
|
-
* Create a new instance of LoggingClient.
|
|
21
|
-
* @param config The configuration for the client.
|
|
22
|
-
*/
|
|
23
|
-
constructor(config) {
|
|
24
|
-
super(LoggingClient._CLASS_NAME, config, "logging");
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Log an entry to the connector.
|
|
28
|
-
* @param logEntry The entry to log.
|
|
29
|
-
* @returns Nothing.
|
|
30
|
-
*/
|
|
31
|
-
async log(logEntry) {
|
|
32
|
-
Guards.object(this.CLASS_NAME, "logEntry", logEntry);
|
|
33
|
-
await this.fetch("/", "POST", {
|
|
34
|
-
body: logEntry
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Query the log entries.
|
|
39
|
-
* @param level The level of the log entries.
|
|
40
|
-
* @param source The source of the log entries.
|
|
41
|
-
* @param timeStart The inclusive time as the start of the log entries.
|
|
42
|
-
* @param timeEnd The inclusive time as the end of the log entries.
|
|
43
|
-
* @param cursor The cursor to request the next page of entities.
|
|
44
|
-
* @param pageSize The maximum number of entities in a page.
|
|
45
|
-
* @returns All the entities for the storage matching the conditions,
|
|
46
|
-
* and a cursor which can be used to request more entities.
|
|
47
|
-
*/
|
|
48
|
-
async query(level, source, timeStart, timeEnd, cursor, pageSize) {
|
|
49
|
-
const response = await this.fetch("/", "GET", {
|
|
50
|
-
query: {
|
|
51
|
-
level,
|
|
52
|
-
source,
|
|
53
|
-
timeStart,
|
|
54
|
-
timeEnd,
|
|
55
|
-
cursor,
|
|
56
|
-
pageSize
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
return response.body;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { LoggingClient };
|