Skip to content
This repository was archived by the owner on Jul 27, 2023. It is now read-only.

Commit ed2cd59

Browse files
committed
Add Winston transport + example
- Format examples using prettier
1 parent d478290 commit ed2cd59

12 files changed

+1066
-32
lines changed

examples/apl-query.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ import Client from '@axiomhq/axiom-node';
55
const client = new Client();
66

77
async function aplQuery() {
8-
const aplQuery = "['my-dataset'] | where status == 500"
8+
const aplQuery = "['my-dataset'] | where status == 500";
99

1010
const res = await client.datasets.aplQuery(aplQuery);
1111
if (!res.matches || res.matches.length === 0) {
1212
console.warn('no matches found');
1313
return;
1414
}
1515

16-
for(let matched of res.matches) {
16+
for (let matched of res.matches) {
1717
console.log(matched.data);
18-
}
18+
}
1919
}
2020

2121
aplQuery();

examples/ingest-events.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ import Client, { datasets } from '@axiomhq/axiom-node';
33
const client = new Client();
44

55
async function ingest() {
6-
const events = [{
7-
'foo': 'bar'
8-
},
9-
{
10-
'x': 'y'
11-
}];
6+
const events = [
7+
{
8+
foo: 'bar',
9+
},
10+
{
11+
x: 'y',
12+
},
13+
];
1214

1315
const res = await client.datasets.ingestEvents('test', events);
1416
console.log('Ingested %d events with %d failures', res.ingested, res.failed);

examples/ingest-string.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
const { Readable } = require("stream")
1+
const { Readable } = require('stream');
22
import Client, { datasets } from '@axiomhq/axiom-node';
33

44
const client = new Client();
55

66
async function ingestString() {
7-
const str = JSON.stringify([
8-
{"foo": "bar"},
9-
{"foo": "bar"},
10-
{"bar": "baz"}
11-
]);
7+
const str = JSON.stringify([{ foo: 'bar' }, { foo: 'bar' }, { bar: 'baz' }]);
128
const stream = Readable.from(str);
139
const res = await client.datasets.ingest(
1410
'test',

examples/list-datasets.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const client = new Client();
44

55
async function listDatasets() {
66
const res = await client.datasets.list();
7-
for(let ds of res) {
7+
for (let ds of res) {
88
console.log(`found dataset: ${ds.name}`);
99
}
1010
}

0 commit comments

Comments
 (0)