@spinajs/log-source-graphana-loki 2.0.180 → 2.0.181
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/lib/cjs/index.d.ts +39 -39
- package/lib/cjs/index.js +145 -145
- package/lib/cjs/index.js.map +1 -1
- package/lib/mjs/index.d.ts +39 -39
- package/lib/mjs/index.js +139 -139
- package/lib/mjs/index.js.map +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.mjs.tsbuildinfo +1 -1
- package/package.json +4 -4
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IInstanceCheck } from "@spinajs/di";
|
|
3
|
-
import { Log, ILogEntry, LogTarget, ICommonTargetOptions } from "@spinajs/log";
|
|
4
|
-
import { Axios } from "axios";
|
|
5
|
-
export interface IGraphanaOptions extends ICommonTargetOptions {
|
|
6
|
-
options: {
|
|
7
|
-
interval: number;
|
|
8
|
-
bufferSize: number;
|
|
9
|
-
timeout: number;
|
|
10
|
-
host: string;
|
|
11
|
-
auth: {
|
|
12
|
-
username: string;
|
|
13
|
-
password: string;
|
|
14
|
-
};
|
|
15
|
-
labels: {
|
|
16
|
-
app: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
declare enum TargetStatus {
|
|
21
|
-
WRITTING = 0,
|
|
22
|
-
PENDING = 1,
|
|
23
|
-
IDLE = 2
|
|
24
|
-
}
|
|
25
|
-
export declare class GraphanaLokiLogTarget extends LogTarget<IGraphanaOptions> implements IInstanceCheck {
|
|
26
|
-
protected Log: Log;
|
|
27
|
-
protected Entries: ILogEntry[];
|
|
28
|
-
protected WriteEntries: ILogEntry[];
|
|
29
|
-
protected Status: TargetStatus;
|
|
30
|
-
protected FlushTimer: NodeJS.Timer;
|
|
31
|
-
protected AxiosInstance: Axios;
|
|
32
|
-
constructor(options: IGraphanaOptions);
|
|
33
|
-
__checkInstance__(creationOptions: IGraphanaOptions[]): boolean;
|
|
34
|
-
resolve(): void;
|
|
35
|
-
write(data: ILogEntry): void;
|
|
36
|
-
dispose(): Promise<void>;
|
|
37
|
-
protected flush(): void;
|
|
38
|
-
}
|
|
39
|
-
export {};
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IInstanceCheck } from "@spinajs/di";
|
|
3
|
+
import { Log, ILogEntry, LogTarget, ICommonTargetOptions } from "@spinajs/log";
|
|
4
|
+
import { Axios } from "axios";
|
|
5
|
+
export interface IGraphanaOptions extends ICommonTargetOptions {
|
|
6
|
+
options: {
|
|
7
|
+
interval: number;
|
|
8
|
+
bufferSize: number;
|
|
9
|
+
timeout: number;
|
|
10
|
+
host: string;
|
|
11
|
+
auth: {
|
|
12
|
+
username: string;
|
|
13
|
+
password: string;
|
|
14
|
+
};
|
|
15
|
+
labels: {
|
|
16
|
+
app: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
declare enum TargetStatus {
|
|
21
|
+
WRITTING = 0,
|
|
22
|
+
PENDING = 1,
|
|
23
|
+
IDLE = 2
|
|
24
|
+
}
|
|
25
|
+
export declare class GraphanaLokiLogTarget extends LogTarget<IGraphanaOptions> implements IInstanceCheck {
|
|
26
|
+
protected Log: Log;
|
|
27
|
+
protected Entries: ILogEntry[];
|
|
28
|
+
protected WriteEntries: ILogEntry[];
|
|
29
|
+
protected Status: TargetStatus;
|
|
30
|
+
protected FlushTimer: NodeJS.Timer;
|
|
31
|
+
protected AxiosInstance: Axios;
|
|
32
|
+
constructor(options: IGraphanaOptions);
|
|
33
|
+
__checkInstance__(creationOptions: IGraphanaOptions[]): boolean;
|
|
34
|
+
resolve(): void;
|
|
35
|
+
write(data: ILogEntry): void;
|
|
36
|
+
dispose(): Promise<void>;
|
|
37
|
+
protected flush(): void;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
40
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,146 +1,146 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.GraphanaLokiLogTarget = void 0;
|
|
16
|
-
/* eslint-disable promise/always-return */
|
|
17
|
-
/* eslint-disable security/detect-object-injection */
|
|
18
|
-
const configuration_common_1 = require("@spinajs/configuration-common");
|
|
19
|
-
const di_1 = require("@spinajs/di");
|
|
20
|
-
const log_1 = require("@spinajs/log");
|
|
21
|
-
const axios_1 = __importDefault(require("axios"));
|
|
22
|
-
var TargetStatus;
|
|
23
|
-
(function (TargetStatus) {
|
|
24
|
-
TargetStatus[TargetStatus["WRITTING"] = 0] = "WRITTING";
|
|
25
|
-
TargetStatus[TargetStatus["PENDING"] = 1] = "PENDING";
|
|
26
|
-
TargetStatus[TargetStatus["IDLE"] = 2] = "IDLE";
|
|
27
|
-
})(TargetStatus || (TargetStatus = {}));
|
|
28
|
-
// we mark per instance check becouse we can have multiple file targes
|
|
29
|
-
// for different files/paths/logs but we dont want to create every time writer for same.
|
|
30
|
-
let GraphanaLokiLogTarget = class GraphanaLokiLogTarget extends log_1.LogTarget {
|
|
31
|
-
constructor(options) {
|
|
32
|
-
super(options);
|
|
33
|
-
this.Entries = [];
|
|
34
|
-
this.WriteEntries = [];
|
|
35
|
-
this.Status = TargetStatus.IDLE;
|
|
36
|
-
this.Options.options = Object.assign({
|
|
37
|
-
interval: 3000,
|
|
38
|
-
bufferSize: 10,
|
|
39
|
-
timeout: 1000,
|
|
40
|
-
}, this.Options.options);
|
|
41
|
-
}
|
|
42
|
-
__checkInstance__(creationOptions) {
|
|
43
|
-
return this.Options.name === creationOptions[0].name;
|
|
44
|
-
}
|
|
45
|
-
resolve() {
|
|
46
|
-
this.AxiosInstance = axios_1.default.create({
|
|
47
|
-
baseURL: this.Options.options.host,
|
|
48
|
-
headers: {
|
|
49
|
-
"Content-Type": "application/json",
|
|
50
|
-
Authorization: `Basic ${Buffer.from(`${this.Options.options.auth.username}:${this.Options.options.auth.password}`).toString("base64")}`,
|
|
51
|
-
},
|
|
52
|
-
timeout: this.Options.options.timeout,
|
|
53
|
-
});
|
|
54
|
-
this.FlushTimer = setInterval(() => {
|
|
55
|
-
// do not flush, if we already writting to file
|
|
56
|
-
if (this.Status !== TargetStatus.IDLE) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
this.WriteEntries = [...this.WriteEntries, ...this.Entries];
|
|
60
|
-
this.Entries = [];
|
|
61
|
-
setImmediate(() => {
|
|
62
|
-
this.flush();
|
|
63
|
-
});
|
|
64
|
-
}, this.Options.options.interval ?? 3000);
|
|
65
|
-
}
|
|
66
|
-
write(data) {
|
|
67
|
-
if (!this.Options.enabled) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
data.Variables["n_timestamp"] = new Date().getTime() * 1000000;
|
|
71
|
-
this.Entries.push(data);
|
|
72
|
-
// if we already writting, skip buffer check & write to file
|
|
73
|
-
// wait until write is finished
|
|
74
|
-
if (this.Status !== TargetStatus.IDLE) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (this.Entries.length >= this.Options.options.bufferSize) {
|
|
78
|
-
this.Status = TargetStatus.PENDING;
|
|
79
|
-
this.WriteEntries = [...this.WriteEntries, ...this.Entries];
|
|
80
|
-
this.Entries = [];
|
|
81
|
-
// write at end of nodejs event loop all buffered messages at once
|
|
82
|
-
setImmediate(() => {
|
|
83
|
-
this.flush();
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
async dispose() {
|
|
88
|
-
// stop flush timer
|
|
89
|
-
clearInterval(this.FlushTimer);
|
|
90
|
-
this.WriteEntries = [...this.WriteEntries, ...this.Entries];
|
|
91
|
-
this.Entries = [];
|
|
92
|
-
// write all messages from buffer
|
|
93
|
-
this.flush();
|
|
94
|
-
}
|
|
95
|
-
flush() {
|
|
96
|
-
if (this.WriteEntries.length === 0) {
|
|
97
|
-
this.Status = TargetStatus.IDLE;
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const streams = new Map();
|
|
101
|
-
const keyFor = (x) => {
|
|
102
|
-
return [this.Options.options.labels.app, x.Variables.logger, x.Variables.level, ...Object.values(this.Options.options.labels)].join("-");
|
|
103
|
-
};
|
|
104
|
-
const valFor = (x) => [x.Variables["n_timestamp"].toString(), (0, configuration_common_1.format)(x.Variables, this.Options.layout)];
|
|
105
|
-
this.Status = TargetStatus.WRITTING;
|
|
106
|
-
this.WriteEntries.forEach((x) => {
|
|
107
|
-
const key = keyFor(x);
|
|
108
|
-
const stream = streams.get(key);
|
|
109
|
-
if (!stream) {
|
|
110
|
-
streams.set(key, {
|
|
111
|
-
stream: {
|
|
112
|
-
logger: x.Variables.logger,
|
|
113
|
-
level: x.Variables.level,
|
|
114
|
-
app: this.Options.options.labels.app,
|
|
115
|
-
...this.Options.options.labels,
|
|
116
|
-
},
|
|
117
|
-
values: [valFor(x)],
|
|
118
|
-
});
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
stream.values.push(valFor(x));
|
|
122
|
-
});
|
|
123
|
-
this.AxiosInstance.post("/loki/api/v1/push", { streams: [...streams.values()] })
|
|
124
|
-
.then(() => {
|
|
125
|
-
this.Status = TargetStatus.IDLE;
|
|
126
|
-
this.Log.trace(`Wrote buffered messages to graphana target at url ${this.Options.options.host}, ${this.WriteEntries.length} messages.`);
|
|
127
|
-
this.WriteEntries = [];
|
|
128
|
-
})
|
|
129
|
-
.catch((err) => {
|
|
130
|
-
// log error message to others if applicable eg. console
|
|
131
|
-
this.Log.error(err, `Cannot write log messages to graphana target`);
|
|
132
|
-
this.Status = TargetStatus.IDLE;
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
GraphanaLokiLogTarget
|
|
141
|
-
|
|
142
|
-
(0, di_1.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.GraphanaLokiLogTarget = void 0;
|
|
16
|
+
/* eslint-disable promise/always-return */
|
|
17
|
+
/* eslint-disable security/detect-object-injection */
|
|
18
|
+
const configuration_common_1 = require("@spinajs/configuration-common");
|
|
19
|
+
const di_1 = require("@spinajs/di");
|
|
20
|
+
const log_1 = require("@spinajs/log");
|
|
21
|
+
const axios_1 = __importDefault(require("axios"));
|
|
22
|
+
var TargetStatus;
|
|
23
|
+
(function (TargetStatus) {
|
|
24
|
+
TargetStatus[TargetStatus["WRITTING"] = 0] = "WRITTING";
|
|
25
|
+
TargetStatus[TargetStatus["PENDING"] = 1] = "PENDING";
|
|
26
|
+
TargetStatus[TargetStatus["IDLE"] = 2] = "IDLE";
|
|
27
|
+
})(TargetStatus || (TargetStatus = {}));
|
|
28
|
+
// we mark per instance check becouse we can have multiple file targes
|
|
29
|
+
// for different files/paths/logs but we dont want to create every time writer for same.
|
|
30
|
+
let GraphanaLokiLogTarget = class GraphanaLokiLogTarget extends log_1.LogTarget {
|
|
31
|
+
constructor(options) {
|
|
32
|
+
super(options);
|
|
33
|
+
this.Entries = [];
|
|
34
|
+
this.WriteEntries = [];
|
|
35
|
+
this.Status = TargetStatus.IDLE;
|
|
36
|
+
this.Options.options = Object.assign({
|
|
37
|
+
interval: 3000,
|
|
38
|
+
bufferSize: 10,
|
|
39
|
+
timeout: 1000,
|
|
40
|
+
}, this.Options.options);
|
|
41
|
+
}
|
|
42
|
+
__checkInstance__(creationOptions) {
|
|
43
|
+
return this.Options.name === creationOptions[0].name;
|
|
44
|
+
}
|
|
45
|
+
resolve() {
|
|
46
|
+
this.AxiosInstance = axios_1.default.create({
|
|
47
|
+
baseURL: this.Options.options.host,
|
|
48
|
+
headers: {
|
|
49
|
+
"Content-Type": "application/json",
|
|
50
|
+
Authorization: `Basic ${Buffer.from(`${this.Options.options.auth.username}:${this.Options.options.auth.password}`).toString("base64")}`,
|
|
51
|
+
},
|
|
52
|
+
timeout: this.Options.options.timeout,
|
|
53
|
+
});
|
|
54
|
+
this.FlushTimer = setInterval(() => {
|
|
55
|
+
// do not flush, if we already writting to file
|
|
56
|
+
if (this.Status !== TargetStatus.IDLE) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.WriteEntries = [...this.WriteEntries, ...this.Entries];
|
|
60
|
+
this.Entries = [];
|
|
61
|
+
setImmediate(() => {
|
|
62
|
+
this.flush();
|
|
63
|
+
});
|
|
64
|
+
}, this.Options.options.interval ?? 3000);
|
|
65
|
+
}
|
|
66
|
+
write(data) {
|
|
67
|
+
if (!this.Options.enabled) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
data.Variables["n_timestamp"] = new Date().getTime() * 1000000;
|
|
71
|
+
this.Entries.push(data);
|
|
72
|
+
// if we already writting, skip buffer check & write to file
|
|
73
|
+
// wait until write is finished
|
|
74
|
+
if (this.Status !== TargetStatus.IDLE) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (this.Entries.length >= this.Options.options.bufferSize) {
|
|
78
|
+
this.Status = TargetStatus.PENDING;
|
|
79
|
+
this.WriteEntries = [...this.WriteEntries, ...this.Entries];
|
|
80
|
+
this.Entries = [];
|
|
81
|
+
// write at end of nodejs event loop all buffered messages at once
|
|
82
|
+
setImmediate(() => {
|
|
83
|
+
this.flush();
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
async dispose() {
|
|
88
|
+
// stop flush timer
|
|
89
|
+
clearInterval(this.FlushTimer);
|
|
90
|
+
this.WriteEntries = [...this.WriteEntries, ...this.Entries];
|
|
91
|
+
this.Entries = [];
|
|
92
|
+
// write all messages from buffer
|
|
93
|
+
this.flush();
|
|
94
|
+
}
|
|
95
|
+
flush() {
|
|
96
|
+
if (this.WriteEntries.length === 0) {
|
|
97
|
+
this.Status = TargetStatus.IDLE;
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const streams = new Map();
|
|
101
|
+
const keyFor = (x) => {
|
|
102
|
+
return [this.Options.options.labels.app, x.Variables.logger, x.Variables.level, ...Object.values(this.Options.options.labels)].join("-");
|
|
103
|
+
};
|
|
104
|
+
const valFor = (x) => [x.Variables["n_timestamp"].toString(), (0, configuration_common_1.format)(x.Variables, this.Options.layout)];
|
|
105
|
+
this.Status = TargetStatus.WRITTING;
|
|
106
|
+
this.WriteEntries.forEach((x) => {
|
|
107
|
+
const key = keyFor(x);
|
|
108
|
+
const stream = streams.get(key);
|
|
109
|
+
if (!stream) {
|
|
110
|
+
streams.set(key, {
|
|
111
|
+
stream: {
|
|
112
|
+
logger: x.Variables.logger,
|
|
113
|
+
level: x.Variables.level,
|
|
114
|
+
app: this.Options.options.labels.app,
|
|
115
|
+
...this.Options.options.labels,
|
|
116
|
+
},
|
|
117
|
+
values: [valFor(x)],
|
|
118
|
+
});
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
stream.values.push(valFor(x));
|
|
122
|
+
});
|
|
123
|
+
this.AxiosInstance.post("/loki/api/v1/push", { streams: [...streams.values()] })
|
|
124
|
+
.then(() => {
|
|
125
|
+
this.Status = TargetStatus.IDLE;
|
|
126
|
+
this.Log.trace(`Wrote buffered messages to graphana target at url ${this.Options.options.host}, ${this.WriteEntries.length} messages.`);
|
|
127
|
+
this.WriteEntries = [];
|
|
128
|
+
})
|
|
129
|
+
.catch((err) => {
|
|
130
|
+
// log error message to others if applicable eg. console
|
|
131
|
+
this.Log.error(err, `Cannot write log messages to graphana target`);
|
|
132
|
+
this.Status = TargetStatus.IDLE;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
exports.GraphanaLokiLogTarget = GraphanaLokiLogTarget;
|
|
137
|
+
__decorate([
|
|
138
|
+
(0, log_1.Logger)("LogLokiTarget"),
|
|
139
|
+
__metadata("design:type", log_1.Log)
|
|
140
|
+
], GraphanaLokiLogTarget.prototype, "Log", void 0);
|
|
141
|
+
exports.GraphanaLokiLogTarget = GraphanaLokiLogTarget = __decorate([
|
|
142
|
+
(0, di_1.PerInstanceCheck)(),
|
|
143
|
+
(0, di_1.Injectable)("GraphanaLogTarget"),
|
|
144
|
+
__metadata("design:paramtypes", [Object])
|
|
145
|
+
], GraphanaLokiLogTarget);
|
|
146
146
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAA0C;AAC1C,qDAAqD;AACrD,wEAAuD;AACvD,oCAA2E;AAC3E,sCAAuF;AAGvF,kDAAqC;AA4BrC,IAAK,YAIJ;AAJD,WAAK,YAAY;IACf,uDAAQ,CAAA;IACR,qDAAO,CAAA;IACP,+CAAI,CAAA;AACN,CAAC,EAJI,YAAY,KAAZ,YAAY,QAIhB;AAED,sEAAsE;AACtE,wFAAwF;AAGjF,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,eAA2B;IAYpE,YAAY,OAAyB;QACnC,KAAK,CAAC,OAAO,CAAC,CAAC;QATP,YAAO,GAAgB,EAAE,CAAC;QAC1B,iBAAY,GAAgB,EAAE,CAAC;QAE/B,WAAM,GAAiB,YAAY,CAAC,IAAI,CAAC;QAQjD,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAClC;YACE,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE,EAAE;YACd,OAAO,EAAE,IAAI;SACd,EACD,IAAI,CAAC,OAAO,CAAC,OAAO,CACrB,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,eAAmC;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACvD,CAAC;IAEM,OAAO;QACZ,IAAI,CAAC,aAAa,GAAG,eAAK,CAAC,MAAM,CAAC;Y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AAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;aAC7E,IAAI,CAAC,GAAG,EAAE;YACT,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,qDAAqD,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,YAAY,CAAC,MAAM,YAAY,CAAC,CAAC;YACxI,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACzB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACb,wDAAwD;YACxD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,+CAA+C,CAAC,CAAC;YACrE,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC;QAClC,CAAC,CAAC,CAAC;IACP,CAAC;CACF,CAAA;AA3IY,sDAAqB;AAEtB;IADT,IAAA,YAAM,EAAC,eAAe,CAAC;8BACT,SAAG;kDAAC;gCAFR,qBAAqB;IAFjC,IAAA,qBAAgB,GAAE;IAClB,IAAA,eAAU,EAAC,mBAAmB,CAAC;;GACnB,qBAAqB,CA2IjC"}
|
package/lib/mjs/index.d.ts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { IInstanceCheck } from "@spinajs/di";
|
|
3
|
-
import { Log, ILogEntry, LogTarget, ICommonTargetOptions } from "@spinajs/log";
|
|
4
|
-
import { Axios } from "axios";
|
|
5
|
-
export interface IGraphanaOptions extends ICommonTargetOptions {
|
|
6
|
-
options: {
|
|
7
|
-
interval: number;
|
|
8
|
-
bufferSize: number;
|
|
9
|
-
timeout: number;
|
|
10
|
-
host: string;
|
|
11
|
-
auth: {
|
|
12
|
-
username: string;
|
|
13
|
-
password: string;
|
|
14
|
-
};
|
|
15
|
-
labels: {
|
|
16
|
-
app: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
declare enum TargetStatus {
|
|
21
|
-
WRITTING = 0,
|
|
22
|
-
PENDING = 1,
|
|
23
|
-
IDLE = 2
|
|
24
|
-
}
|
|
25
|
-
export declare class GraphanaLokiLogTarget extends LogTarget<IGraphanaOptions> implements IInstanceCheck {
|
|
26
|
-
protected Log: Log;
|
|
27
|
-
protected Entries: ILogEntry[];
|
|
28
|
-
protected WriteEntries: ILogEntry[];
|
|
29
|
-
protected Status: TargetStatus;
|
|
30
|
-
protected FlushTimer: NodeJS.Timer;
|
|
31
|
-
protected AxiosInstance: Axios;
|
|
32
|
-
constructor(options: IGraphanaOptions);
|
|
33
|
-
__checkInstance__(creationOptions: IGraphanaOptions[]): boolean;
|
|
34
|
-
resolve(): void;
|
|
35
|
-
write(data: ILogEntry): void;
|
|
36
|
-
dispose(): Promise<void>;
|
|
37
|
-
protected flush(): void;
|
|
38
|
-
}
|
|
39
|
-
export {};
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import { IInstanceCheck } from "@spinajs/di";
|
|
3
|
+
import { Log, ILogEntry, LogTarget, ICommonTargetOptions } from "@spinajs/log";
|
|
4
|
+
import { Axios } from "axios";
|
|
5
|
+
export interface IGraphanaOptions extends ICommonTargetOptions {
|
|
6
|
+
options: {
|
|
7
|
+
interval: number;
|
|
8
|
+
bufferSize: number;
|
|
9
|
+
timeout: number;
|
|
10
|
+
host: string;
|
|
11
|
+
auth: {
|
|
12
|
+
username: string;
|
|
13
|
+
password: string;
|
|
14
|
+
};
|
|
15
|
+
labels: {
|
|
16
|
+
app: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
declare enum TargetStatus {
|
|
21
|
+
WRITTING = 0,
|
|
22
|
+
PENDING = 1,
|
|
23
|
+
IDLE = 2
|
|
24
|
+
}
|
|
25
|
+
export declare class GraphanaLokiLogTarget extends LogTarget<IGraphanaOptions> implements IInstanceCheck {
|
|
26
|
+
protected Log: Log;
|
|
27
|
+
protected Entries: ILogEntry[];
|
|
28
|
+
protected WriteEntries: ILogEntry[];
|
|
29
|
+
protected Status: TargetStatus;
|
|
30
|
+
protected FlushTimer: NodeJS.Timer;
|
|
31
|
+
protected AxiosInstance: Axios;
|
|
32
|
+
constructor(options: IGraphanaOptions);
|
|
33
|
+
__checkInstance__(creationOptions: IGraphanaOptions[]): boolean;
|
|
34
|
+
resolve(): void;
|
|
35
|
+
write(data: ILogEntry): void;
|
|
36
|
+
dispose(): Promise<void>;
|
|
37
|
+
protected flush(): void;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
40
|
//# sourceMappingURL=index.d.ts.map
|