chore: Basic logging met loki
This commit is contained in:
parent
c07bb959cf
commit
0f8bd3df6a
5 changed files with 133 additions and 23 deletions
|
@ -19,4 +19,31 @@ async function startServer() {
|
|||
});
|
||||
}
|
||||
|
||||
startServer();
|
||||
|
||||
import { LokiClient, LogError, LokiLabels, LogInfo } from 'loki-logger-ts';
|
||||
|
||||
const HostData = {
|
||||
url: "http://localhost:3100/loki/api/v1/push",
|
||||
};
|
||||
|
||||
const labels: LokiLabels = {
|
||||
source: "Test",
|
||||
job: "TestJob",
|
||||
host: "localhost",
|
||||
};
|
||||
|
||||
async function main() {
|
||||
const client = new LokiClient(HostData.url);
|
||||
|
||||
const msg = 'Hello World';
|
||||
await LogError(client, msg, labels);
|
||||
await LogInfo(client, 'Dit is een goed bericht', labels);
|
||||
|
||||
console.log(client.showMetrics());
|
||||
|
||||
console.log(client.getMetrics());
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
// startServer();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue