@twin.org/logging-models 0.0.1-next.10
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/LICENSE +201 -0
- package/README.md +21 -0
- package/dist/cjs/index.cjs +157 -0
- package/dist/esm/index.mjs +152 -0
- package/dist/types/connectors/multiLoggingConnector.d.ts +52 -0
- package/dist/types/connectors/silentLoggingConnector.d.ts +46 -0
- package/dist/types/factories/loggingConnectorFactory.d.ts +6 -0
- package/dist/types/helpers/logEntryHelper.d.ts +12 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/models/ILogEntry.d.ts +33 -0
- package/dist/types/models/ILoggingComponent.d.ts +36 -0
- package/dist/types/models/ILoggingConnector.d.ts +38 -0
- package/dist/types/models/ILoggingLevelsConfig.d.ts +10 -0
- package/dist/types/models/IMultiLoggingConnectorConstructorOptions.d.ts +14 -0
- package/dist/types/models/api/ILoggingCreateRequest.d.ts +10 -0
- package/dist/types/models/api/ILoggingListRequest.d.ts +35 -0
- package/dist/types/models/api/ILoggingListResponse.d.ts +19 -0
- package/dist/types/models/logLevel.d.ts +4 -0
- package/docs/changelog.md +5 -0
- package/docs/examples.md +1 -0
- package/docs/reference/classes/LogEntryHelper.md +35 -0
- package/docs/reference/classes/MultiLoggingConnector.md +128 -0
- package/docs/reference/classes/SilentLoggingConnector.md +118 -0
- package/docs/reference/index.md +26 -0
- package/docs/reference/interfaces/ILogEntry.md +55 -0
- package/docs/reference/interfaces/ILoggingComponent.md +86 -0
- package/docs/reference/interfaces/ILoggingConnector.md +80 -0
- package/docs/reference/interfaces/ILoggingCreateRequest.md +11 -0
- package/docs/reference/interfaces/ILoggingLevelsConfig.md +11 -0
- package/docs/reference/interfaces/ILoggingListRequest.md +47 -0
- package/docs/reference/interfaces/ILoggingListResponse.md +23 -0
- package/docs/reference/interfaces/IMultiLoggingConnectorConstructorOptions.md +19 -0
- package/docs/reference/type-aliases/LogLevel.md +5 -0
- package/docs/reference/variables/LoggingConnectorFactory.md +5 -0
- package/locales/en.json +3 -0
- package/package.json +39 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
import type { IError } from "@twin.org/core";
|
2
|
+
import type { LogLevel } from "./logLevel";
|
3
|
+
/**
|
4
|
+
* Interface describing a log entry.
|
5
|
+
*/
|
6
|
+
export interface ILogEntry {
|
7
|
+
/**
|
8
|
+
* The level of the error being logged.
|
9
|
+
*/
|
10
|
+
level: LogLevel;
|
11
|
+
/**
|
12
|
+
* The source of the log entry.
|
13
|
+
*/
|
14
|
+
source: string;
|
15
|
+
/**
|
16
|
+
* The timestamp of the log entry, if left blank will be populated by the connector.
|
17
|
+
*/
|
18
|
+
ts?: number;
|
19
|
+
/**
|
20
|
+
* The message.
|
21
|
+
*/
|
22
|
+
message: string;
|
23
|
+
/**
|
24
|
+
* Optional error details.
|
25
|
+
*/
|
26
|
+
error?: IError;
|
27
|
+
/**
|
28
|
+
* Optional data for the message.
|
29
|
+
*/
|
30
|
+
data?: {
|
31
|
+
[key: string]: unknown;
|
32
|
+
};
|
33
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import type { IComponent } from "@twin.org/core";
|
2
|
+
import type { ILogEntry } from "./ILogEntry";
|
3
|
+
import type { LogLevel } from "./logLevel";
|
4
|
+
/**
|
5
|
+
* Interface describing a logging contract.
|
6
|
+
*/
|
7
|
+
export interface ILoggingComponent extends IComponent {
|
8
|
+
/**
|
9
|
+
* Log an entry to the component.
|
10
|
+
* @param logEntry The entry to log.
|
11
|
+
* @returns Nothing.
|
12
|
+
*/
|
13
|
+
log(logEntry: ILogEntry): Promise<void>;
|
14
|
+
/**
|
15
|
+
* Query the log entries.
|
16
|
+
* @param level The level of the log entries.
|
17
|
+
* @param source The source of the log entries.
|
18
|
+
* @param timeStart The inclusive time as the start of the log entries.
|
19
|
+
* @param timeEnd The inclusive time as the end of the log entries.
|
20
|
+
* @param cursor The cursor to request the next page of entities.
|
21
|
+
* @param pageSize The maximum number of entities in a page.
|
22
|
+
* @returns All the entities for the storage matching the conditions,
|
23
|
+
* and a cursor which can be used to request more entities.
|
24
|
+
* @throws NotImplementedError if the implementation does not support retrieval.
|
25
|
+
*/
|
26
|
+
query(level?: LogLevel, source?: string, timeStart?: number, timeEnd?: number, cursor?: string, pageSize?: number): Promise<{
|
27
|
+
/**
|
28
|
+
* The entities, which can be partial if a limited keys list was provided.
|
29
|
+
*/
|
30
|
+
entities: ILogEntry[];
|
31
|
+
/**
|
32
|
+
* An optional cursor, when defined can be used to call find to get more entities.
|
33
|
+
*/
|
34
|
+
cursor?: string;
|
35
|
+
}>;
|
36
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import type { IComponent } from "@twin.org/core";
|
2
|
+
import type { EntityCondition, SortDirection } from "@twin.org/entity";
|
3
|
+
import type { ILogEntry } from "./ILogEntry";
|
4
|
+
/**
|
5
|
+
* Interface describing a logging connector.
|
6
|
+
*/
|
7
|
+
export interface ILoggingConnector extends IComponent {
|
8
|
+
/**
|
9
|
+
* Log an entry to the connector.
|
10
|
+
* @param logEntry The entry to log.
|
11
|
+
* @returns Nothing.
|
12
|
+
*/
|
13
|
+
log(logEntry: ILogEntry): Promise<void>;
|
14
|
+
/**
|
15
|
+
* Query the log entries.
|
16
|
+
* @param conditions The conditions to match for the entities.
|
17
|
+
* @param sortProperties The optional sort order.
|
18
|
+
* @param properties The optional keys to return, defaults to all.
|
19
|
+
* @param cursor The cursor to request the next page of entities.
|
20
|
+
* @param pageSize The maximum number of entities in a page.
|
21
|
+
* @returns All the entities for the storage matching the conditions,
|
22
|
+
* and a cursor which can be used to request more entities.
|
23
|
+
* @throws NotImplementedError if the implementation does not support retrieval.
|
24
|
+
*/
|
25
|
+
query(conditions?: EntityCondition<ILogEntry>, sortProperties?: {
|
26
|
+
property: keyof Omit<ILogEntry, "error" | "data">;
|
27
|
+
sortDirection: SortDirection;
|
28
|
+
}[], properties?: (keyof ILogEntry)[], cursor?: string, pageSize?: number): Promise<{
|
29
|
+
/**
|
30
|
+
* The entities, which can be partial if a limited keys list was provided.
|
31
|
+
*/
|
32
|
+
entities: Partial<ILogEntry>[];
|
33
|
+
/**
|
34
|
+
* An optional cursor, when defined can be used to call find to get more entities.
|
35
|
+
*/
|
36
|
+
cursor?: string;
|
37
|
+
}>;
|
38
|
+
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { LogLevel } from "./logLevel";
|
2
|
+
/**
|
3
|
+
* Configuration for the logging connectors to specify the levels to display.
|
4
|
+
*/
|
5
|
+
export interface ILoggingLevelsConfig {
|
6
|
+
/**
|
7
|
+
* The log levels to display, will default to all.
|
8
|
+
*/
|
9
|
+
levels?: LogLevel[];
|
10
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import type { ILoggingLevelsConfig } from "../models/ILoggingLevelsConfig";
|
2
|
+
/**
|
3
|
+
* Options for the multi logging connector.
|
4
|
+
*/
|
5
|
+
export interface IMultiLoggingConnectorConstructorOptions {
|
6
|
+
/**
|
7
|
+
* The logging connectors to multiplex.
|
8
|
+
*/
|
9
|
+
loggingConnectorTypes: string[];
|
10
|
+
/**
|
11
|
+
* The configuration for the logging connector.
|
12
|
+
*/
|
13
|
+
config?: ILoggingLevelsConfig;
|
14
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import type { LogLevel } from "../logLevel";
|
2
|
+
/**
|
3
|
+
* Get the a list of the log entries.
|
4
|
+
*/
|
5
|
+
export interface ILoggingListRequest {
|
6
|
+
/**
|
7
|
+
* The query parameters.
|
8
|
+
*/
|
9
|
+
query: {
|
10
|
+
/**
|
11
|
+
* The level of the log entries to retrieve.
|
12
|
+
*/
|
13
|
+
level?: LogLevel;
|
14
|
+
/**
|
15
|
+
* The source of the log entries to retrieve.
|
16
|
+
*/
|
17
|
+
source?: string;
|
18
|
+
/**
|
19
|
+
* The start time of the metrics to retrieve as a timestamp in ms.
|
20
|
+
*/
|
21
|
+
timeStart?: number;
|
22
|
+
/**
|
23
|
+
* The end time of the metrics to retrieve as a timestamp in ms.
|
24
|
+
*/
|
25
|
+
timeEnd?: number;
|
26
|
+
/**
|
27
|
+
* The optional cursor to get next chunk.
|
28
|
+
*/
|
29
|
+
cursor?: string;
|
30
|
+
/**
|
31
|
+
* The maximum number of entities in a page.
|
32
|
+
*/
|
33
|
+
pageSize?: number;
|
34
|
+
};
|
35
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import type { ILogEntry } from "../ILogEntry";
|
2
|
+
/**
|
3
|
+
* Response for log entry list request.
|
4
|
+
*/
|
5
|
+
export interface ILoggingListResponse {
|
6
|
+
/**
|
7
|
+
* The response payload.
|
8
|
+
*/
|
9
|
+
body: {
|
10
|
+
/**
|
11
|
+
* The entities, which can be partial if a limited keys list was provided.
|
12
|
+
*/
|
13
|
+
entities: ILogEntry[];
|
14
|
+
/**
|
15
|
+
* An optional cursor, when defined can be used to call find to get more entities.
|
16
|
+
*/
|
17
|
+
cursor?: string;
|
18
|
+
};
|
19
|
+
}
|
package/docs/examples.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# @twin.org/logging-models - Examples
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Class: LogEntryHelper
|
2
|
+
|
3
|
+
Helper class for log entry operations.
|
4
|
+
|
5
|
+
## Constructors
|
6
|
+
|
7
|
+
### new LogEntryHelper()
|
8
|
+
|
9
|
+
> **new LogEntryHelper**(): [`LogEntryHelper`](LogEntryHelper.md)
|
10
|
+
|
11
|
+
#### Returns
|
12
|
+
|
13
|
+
[`LogEntryHelper`](LogEntryHelper.md)
|
14
|
+
|
15
|
+
## Methods
|
16
|
+
|
17
|
+
### translate()
|
18
|
+
|
19
|
+
> `static` **translate**(`logEntry`): `undefined` \| `string`
|
20
|
+
|
21
|
+
Translate the log entry.
|
22
|
+
|
23
|
+
#### Parameters
|
24
|
+
|
25
|
+
##### logEntry
|
26
|
+
|
27
|
+
[`ILogEntry`](../interfaces/ILogEntry.md)
|
28
|
+
|
29
|
+
The log entry.
|
30
|
+
|
31
|
+
#### Returns
|
32
|
+
|
33
|
+
`undefined` \| `string`
|
34
|
+
|
35
|
+
The translated log entry if a translation can be found.
|
@@ -0,0 +1,128 @@
|
|
1
|
+
# Class: MultiLoggingConnector
|
2
|
+
|
3
|
+
Class for performing logging operations on multiple connectors.
|
4
|
+
|
5
|
+
## Implements
|
6
|
+
|
7
|
+
- [`ILoggingConnector`](../interfaces/ILoggingConnector.md)
|
8
|
+
|
9
|
+
## Constructors
|
10
|
+
|
11
|
+
### new MultiLoggingConnector()
|
12
|
+
|
13
|
+
> **new MultiLoggingConnector**(`options`): [`MultiLoggingConnector`](MultiLoggingConnector.md)
|
14
|
+
|
15
|
+
Create a new instance of MultiLoggingConnector.
|
16
|
+
|
17
|
+
#### Parameters
|
18
|
+
|
19
|
+
##### options
|
20
|
+
|
21
|
+
[`IMultiLoggingConnectorConstructorOptions`](../interfaces/IMultiLoggingConnectorConstructorOptions.md)
|
22
|
+
|
23
|
+
The options for the connector.
|
24
|
+
|
25
|
+
#### Returns
|
26
|
+
|
27
|
+
[`MultiLoggingConnector`](MultiLoggingConnector.md)
|
28
|
+
|
29
|
+
## Properties
|
30
|
+
|
31
|
+
### NAMESPACE
|
32
|
+
|
33
|
+
> `readonly` `static` **NAMESPACE**: `string` = `"multi"`
|
34
|
+
|
35
|
+
The namespace for the logging connector.
|
36
|
+
|
37
|
+
***
|
38
|
+
|
39
|
+
### CLASS\_NAME
|
40
|
+
|
41
|
+
> `readonly` **CLASS\_NAME**: `string`
|
42
|
+
|
43
|
+
Runtime name for the class.
|
44
|
+
|
45
|
+
#### Implementation of
|
46
|
+
|
47
|
+
`ILoggingConnector.CLASS_NAME`
|
48
|
+
|
49
|
+
## Methods
|
50
|
+
|
51
|
+
### log()
|
52
|
+
|
53
|
+
> **log**(`logEntry`): `Promise`\<`void`\>
|
54
|
+
|
55
|
+
Log an entry to the connector.
|
56
|
+
|
57
|
+
#### Parameters
|
58
|
+
|
59
|
+
##### logEntry
|
60
|
+
|
61
|
+
[`ILogEntry`](../interfaces/ILogEntry.md)
|
62
|
+
|
63
|
+
The entry to log.
|
64
|
+
|
65
|
+
#### Returns
|
66
|
+
|
67
|
+
`Promise`\<`void`\>
|
68
|
+
|
69
|
+
Nothing.
|
70
|
+
|
71
|
+
#### Implementation of
|
72
|
+
|
73
|
+
[`ILoggingConnector`](../interfaces/ILoggingConnector.md).[`log`](../interfaces/ILoggingConnector.md#log)
|
74
|
+
|
75
|
+
***
|
76
|
+
|
77
|
+
### query()
|
78
|
+
|
79
|
+
> **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>[]; `cursor`: `string`; \}\>
|
80
|
+
|
81
|
+
Query the log entries.
|
82
|
+
|
83
|
+
#### Parameters
|
84
|
+
|
85
|
+
##### conditions?
|
86
|
+
|
87
|
+
`EntityCondition`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>
|
88
|
+
|
89
|
+
The conditions to match for the entities.
|
90
|
+
|
91
|
+
##### sortProperties?
|
92
|
+
|
93
|
+
`object`[]
|
94
|
+
|
95
|
+
The optional sort order.
|
96
|
+
|
97
|
+
##### properties?
|
98
|
+
|
99
|
+
keyof [`ILogEntry`](../interfaces/ILogEntry.md)[]
|
100
|
+
|
101
|
+
The optional keys to return, defaults to all.
|
102
|
+
|
103
|
+
##### cursor?
|
104
|
+
|
105
|
+
`string`
|
106
|
+
|
107
|
+
The cursor to request the next page of entities.
|
108
|
+
|
109
|
+
##### pageSize?
|
110
|
+
|
111
|
+
`number`
|
112
|
+
|
113
|
+
The maximum number of entities in a page.
|
114
|
+
|
115
|
+
#### Returns
|
116
|
+
|
117
|
+
`Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>[]; `cursor`: `string`; \}\>
|
118
|
+
|
119
|
+
All the entities for the storage matching the conditions,
|
120
|
+
and a cursor which can be used to request more entities.
|
121
|
+
|
122
|
+
#### Throws
|
123
|
+
|
124
|
+
NotImplementedError if the implementation does not support retrieval.
|
125
|
+
|
126
|
+
#### Implementation of
|
127
|
+
|
128
|
+
[`ILoggingConnector`](../interfaces/ILoggingConnector.md).[`query`](../interfaces/ILoggingConnector.md#query)
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# Class: SilentLoggingConnector
|
2
|
+
|
3
|
+
Class for performing logging operations to nowhere.
|
4
|
+
|
5
|
+
## Implements
|
6
|
+
|
7
|
+
- [`ILoggingConnector`](../interfaces/ILoggingConnector.md)
|
8
|
+
|
9
|
+
## Constructors
|
10
|
+
|
11
|
+
### new SilentLoggingConnector()
|
12
|
+
|
13
|
+
> **new SilentLoggingConnector**(): [`SilentLoggingConnector`](SilentLoggingConnector.md)
|
14
|
+
|
15
|
+
#### Returns
|
16
|
+
|
17
|
+
[`SilentLoggingConnector`](SilentLoggingConnector.md)
|
18
|
+
|
19
|
+
## Properties
|
20
|
+
|
21
|
+
### NAMESPACE
|
22
|
+
|
23
|
+
> `readonly` `static` **NAMESPACE**: `string` = `"silent"`
|
24
|
+
|
25
|
+
The namespace for the logging connector.
|
26
|
+
|
27
|
+
***
|
28
|
+
|
29
|
+
### CLASS\_NAME
|
30
|
+
|
31
|
+
> `readonly` **CLASS\_NAME**: `string`
|
32
|
+
|
33
|
+
Runtime name for the class.
|
34
|
+
|
35
|
+
#### Implementation of
|
36
|
+
|
37
|
+
`ILoggingConnector.CLASS_NAME`
|
38
|
+
|
39
|
+
## Methods
|
40
|
+
|
41
|
+
### log()
|
42
|
+
|
43
|
+
> **log**(`logEntry`): `Promise`\<`void`\>
|
44
|
+
|
45
|
+
Log an entry to the connector.
|
46
|
+
|
47
|
+
#### Parameters
|
48
|
+
|
49
|
+
##### logEntry
|
50
|
+
|
51
|
+
[`ILogEntry`](../interfaces/ILogEntry.md)
|
52
|
+
|
53
|
+
The entry to log.
|
54
|
+
|
55
|
+
#### Returns
|
56
|
+
|
57
|
+
`Promise`\<`void`\>
|
58
|
+
|
59
|
+
Nothing.
|
60
|
+
|
61
|
+
#### Implementation of
|
62
|
+
|
63
|
+
[`ILoggingConnector`](../interfaces/ILoggingConnector.md).[`log`](../interfaces/ILoggingConnector.md#log)
|
64
|
+
|
65
|
+
***
|
66
|
+
|
67
|
+
### query()
|
68
|
+
|
69
|
+
> **query**(`conditions`?, `sortProperties`?, `properties`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>[]; `cursor`: `string`; \}\>
|
70
|
+
|
71
|
+
Query the log entries.
|
72
|
+
|
73
|
+
#### Parameters
|
74
|
+
|
75
|
+
##### conditions?
|
76
|
+
|
77
|
+
`EntityCondition`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>
|
78
|
+
|
79
|
+
The conditions to match for the entities.
|
80
|
+
|
81
|
+
##### sortProperties?
|
82
|
+
|
83
|
+
`object`[]
|
84
|
+
|
85
|
+
The optional sort order.
|
86
|
+
|
87
|
+
##### properties?
|
88
|
+
|
89
|
+
keyof [`ILogEntry`](../interfaces/ILogEntry.md)[]
|
90
|
+
|
91
|
+
The optional keys to return, defaults to all.
|
92
|
+
|
93
|
+
##### cursor?
|
94
|
+
|
95
|
+
`string`
|
96
|
+
|
97
|
+
The cursor to request the next page of entities.
|
98
|
+
|
99
|
+
##### pageSize?
|
100
|
+
|
101
|
+
`number`
|
102
|
+
|
103
|
+
The maximum number of entities in a page.
|
104
|
+
|
105
|
+
#### Returns
|
106
|
+
|
107
|
+
`Promise`\<\{ `entities`: `Partial`\<[`ILogEntry`](../interfaces/ILogEntry.md)\>[]; `cursor`: `string`; \}\>
|
108
|
+
|
109
|
+
All the entities for the storage matching the conditions,
|
110
|
+
and a cursor which can be used to request more entities.
|
111
|
+
|
112
|
+
#### Throws
|
113
|
+
|
114
|
+
NotImplementedError if the implementation does not support retrieval.
|
115
|
+
|
116
|
+
#### Implementation of
|
117
|
+
|
118
|
+
[`ILoggingConnector`](../interfaces/ILoggingConnector.md).[`query`](../interfaces/ILoggingConnector.md#query)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# @twin.org/logging-models
|
2
|
+
|
3
|
+
## Classes
|
4
|
+
|
5
|
+
- [MultiLoggingConnector](classes/MultiLoggingConnector.md)
|
6
|
+
- [SilentLoggingConnector](classes/SilentLoggingConnector.md)
|
7
|
+
- [LogEntryHelper](classes/LogEntryHelper.md)
|
8
|
+
|
9
|
+
## Interfaces
|
10
|
+
|
11
|
+
- [ILogEntry](interfaces/ILogEntry.md)
|
12
|
+
- [ILoggingComponent](interfaces/ILoggingComponent.md)
|
13
|
+
- [ILoggingConnector](interfaces/ILoggingConnector.md)
|
14
|
+
- [ILoggingLevelsConfig](interfaces/ILoggingLevelsConfig.md)
|
15
|
+
- [IMultiLoggingConnectorConstructorOptions](interfaces/IMultiLoggingConnectorConstructorOptions.md)
|
16
|
+
- [ILoggingCreateRequest](interfaces/ILoggingCreateRequest.md)
|
17
|
+
- [ILoggingListRequest](interfaces/ILoggingListRequest.md)
|
18
|
+
- [ILoggingListResponse](interfaces/ILoggingListResponse.md)
|
19
|
+
|
20
|
+
## Type Aliases
|
21
|
+
|
22
|
+
- [LogLevel](type-aliases/LogLevel.md)
|
23
|
+
|
24
|
+
## Variables
|
25
|
+
|
26
|
+
- [LoggingConnectorFactory](variables/LoggingConnectorFactory.md)
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Interface: ILogEntry
|
2
|
+
|
3
|
+
Interface describing a log entry.
|
4
|
+
|
5
|
+
## Properties
|
6
|
+
|
7
|
+
### level
|
8
|
+
|
9
|
+
> **level**: [`LogLevel`](../type-aliases/LogLevel.md)
|
10
|
+
|
11
|
+
The level of the error being logged.
|
12
|
+
|
13
|
+
***
|
14
|
+
|
15
|
+
### source
|
16
|
+
|
17
|
+
> **source**: `string`
|
18
|
+
|
19
|
+
The source of the log entry.
|
20
|
+
|
21
|
+
***
|
22
|
+
|
23
|
+
### ts?
|
24
|
+
|
25
|
+
> `optional` **ts**: `number`
|
26
|
+
|
27
|
+
The timestamp of the log entry, if left blank will be populated by the connector.
|
28
|
+
|
29
|
+
***
|
30
|
+
|
31
|
+
### message
|
32
|
+
|
33
|
+
> **message**: `string`
|
34
|
+
|
35
|
+
The message.
|
36
|
+
|
37
|
+
***
|
38
|
+
|
39
|
+
### error?
|
40
|
+
|
41
|
+
> `optional` **error**: `IError`
|
42
|
+
|
43
|
+
Optional error details.
|
44
|
+
|
45
|
+
***
|
46
|
+
|
47
|
+
### data?
|
48
|
+
|
49
|
+
> `optional` **data**: `object`
|
50
|
+
|
51
|
+
Optional data for the message.
|
52
|
+
|
53
|
+
#### Index Signature
|
54
|
+
|
55
|
+
\[`key`: `string`\]: `unknown`
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# Interface: ILoggingComponent
|
2
|
+
|
3
|
+
Interface describing a logging contract.
|
4
|
+
|
5
|
+
## Extends
|
6
|
+
|
7
|
+
- `IComponent`
|
8
|
+
|
9
|
+
## Methods
|
10
|
+
|
11
|
+
### log()
|
12
|
+
|
13
|
+
> **log**(`logEntry`): `Promise`\<`void`\>
|
14
|
+
|
15
|
+
Log an entry to the component.
|
16
|
+
|
17
|
+
#### Parameters
|
18
|
+
|
19
|
+
##### logEntry
|
20
|
+
|
21
|
+
[`ILogEntry`](ILogEntry.md)
|
22
|
+
|
23
|
+
The entry to log.
|
24
|
+
|
25
|
+
#### Returns
|
26
|
+
|
27
|
+
`Promise`\<`void`\>
|
28
|
+
|
29
|
+
Nothing.
|
30
|
+
|
31
|
+
***
|
32
|
+
|
33
|
+
### query()
|
34
|
+
|
35
|
+
> **query**(`level`?, `source`?, `timeStart`?, `timeEnd`?, `cursor`?, `pageSize`?): `Promise`\<\{ `entities`: [`ILogEntry`](ILogEntry.md)[]; `cursor`: `string`; \}\>
|
36
|
+
|
37
|
+
Query the log entries.
|
38
|
+
|
39
|
+
#### Parameters
|
40
|
+
|
41
|
+
##### level?
|
42
|
+
|
43
|
+
[`LogLevel`](../type-aliases/LogLevel.md)
|
44
|
+
|
45
|
+
The level of the log entries.
|
46
|
+
|
47
|
+
##### source?
|
48
|
+
|
49
|
+
`string`
|
50
|
+
|
51
|
+
The source of the log entries.
|
52
|
+
|
53
|
+
##### timeStart?
|
54
|
+
|
55
|
+
`number`
|
56
|
+
|
57
|
+
The inclusive time as the start of the log entries.
|
58
|
+
|
59
|
+
##### timeEnd?
|
60
|
+
|
61
|
+
`number`
|
62
|
+
|
63
|
+
The inclusive time as the end of the log entries.
|
64
|
+
|
65
|
+
##### cursor?
|
66
|
+
|
67
|
+
`string`
|
68
|
+
|
69
|
+
The cursor to request the next page of entities.
|
70
|
+
|
71
|
+
##### pageSize?
|
72
|
+
|
73
|
+
`number`
|
74
|
+
|
75
|
+
The maximum number of entities in a page.
|
76
|
+
|
77
|
+
#### Returns
|
78
|
+
|
79
|
+
`Promise`\<\{ `entities`: [`ILogEntry`](ILogEntry.md)[]; `cursor`: `string`; \}\>
|
80
|
+
|
81
|
+
All the entities for the storage matching the conditions,
|
82
|
+
and a cursor which can be used to request more entities.
|
83
|
+
|
84
|
+
#### Throws
|
85
|
+
|
86
|
+
NotImplementedError if the implementation does not support retrieval.
|