attlaz-client 1.4.0 → 1.4.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.
|
@@ -2,8 +2,14 @@ import { Endpoint } from './Endpoint';
|
|
|
2
2
|
import { LogQuery } from '../Model/Log/LogQuery';
|
|
3
3
|
import { PagedResult } from '../Model/PagedResult';
|
|
4
4
|
import { Log } from '../Model/Log/Log';
|
|
5
|
+
import { LogStreamId } from '../Model/Log/LogStreamId';
|
|
6
|
+
import { LogLevel } from '../Model/Log/LogLevel';
|
|
5
7
|
export declare class LogEndpoint extends Endpoint {
|
|
6
8
|
getLogs(logQuery: LogQuery): Promise<PagedResult<Log>>;
|
|
7
9
|
save(log: Log): Promise<Log>;
|
|
8
10
|
delete(log: Log): Promise<boolean>;
|
|
11
|
+
clear(logStreamId: LogStreamId): Promise<boolean>;
|
|
12
|
+
getInformation(logStreamId: LogStreamId): Promise<{
|
|
13
|
+
level_count: Map<LogLevel, number>;
|
|
14
|
+
}>;
|
|
9
15
|
}
|
|
@@ -64,7 +64,7 @@ class LogEndpoint extends Endpoint_1.Endpoint {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
async delete(log) {
|
|
67
|
-
let cmd = '/
|
|
67
|
+
let cmd = '/logstreams/:streamId/logs/' + log.id;
|
|
68
68
|
try {
|
|
69
69
|
const removed = await this.httpClient.request(cmd, log, 'DELETE');
|
|
70
70
|
return removed;
|
|
@@ -76,5 +76,35 @@ class LogEndpoint extends Endpoint_1.Endpoint {
|
|
|
76
76
|
throw e;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
+
async clear(logStreamId) {
|
|
80
|
+
let cmd = '/logstreams/' + Utils_1.Utils.base64encode(logStreamId.id) + '/clear';
|
|
81
|
+
try {
|
|
82
|
+
const removed = await this.httpClient.request(cmd, null, 'POST');
|
|
83
|
+
return removed;
|
|
84
|
+
}
|
|
85
|
+
catch (e) {
|
|
86
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
87
|
+
console.error('Failed to save log: ', e);
|
|
88
|
+
}
|
|
89
|
+
throw e;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async getInformation(logStreamId) {
|
|
93
|
+
try {
|
|
94
|
+
let url = '/logstreams/' + Utils_1.Utils.base64encode(logStreamId.id) + '/info';
|
|
95
|
+
const result = await this.request(url);
|
|
96
|
+
if (Utils_1.Utils.isNullOrUndefined(result)) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
// ToDO: parse data
|
|
100
|
+
return result.getData();
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
104
|
+
console.error('Failed to load log stream information: ', error);
|
|
105
|
+
}
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
79
109
|
}
|
|
80
110
|
exports.LogEndpoint = LogEndpoint;
|