Skip to content

Commit 9a26185

Browse files
authored
Merge pull request #51 from logdash-io/chore/readme
chore: update readme with metrics
2 parents b4f1fb8 + a9ece96 commit 9a26185

2 files changed

Lines changed: 37 additions & 12 deletions

File tree

.changeset/stale-buckets-dress.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@logdash/js-sdk": patch
3+
---
4+
5+
chore: update readme with metrics

README.md

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22

33
Logdash is a zero-config observability platform. This package serves an javascript interface to use it.
44

5-
# Pre-requisites
5+
## Pre-requisites
66

7-
Setup your free project in less than 2 minutes at [logdash.io](https://logdash.io/).
7+
Setup your free project in less than 2 minutes at [logdash.io](https://logdash.io/)
88

9-
# Installation
9+
## Installation
1010

1111
```
12-
npm install @logdash/core
12+
npm install @logdash/js-sdk
1313
```
1414

15-
# Usage
15+
## Logging
1616

1717
```typescript
18-
import { createLogDash } from '@logdash/core';
18+
import { createLogDash } from '@logdash/js-sdk';
1919

2020
const { logger } = createLogDash({
21+
// optional, but recommended to see your logs in the dashboard
2122
apiKey: '<your-api-key>',
2223
});
2324

@@ -26,27 +27,46 @@ logger.error('An unexpected error occurred');
2627
logger.warn('Low disk space warning');
2728
```
2829

29-
# View
30+
## Metrics
3031

31-
To see the logs, go to your project dashboard
32+
```typescript
33+
import { createLogDash } from '@logdash/js-sdk';
34+
35+
const { metrics } = createLogDash({
36+
// optional, but recommended as metrics are only hosted remotely
37+
apiKey: '<your-api-key>',
38+
});
39+
40+
// to set absolute value
41+
metrics.set('users', 0);
42+
43+
// to modify existing metric
44+
metrics.mutate('users', 1);
45+
```
46+
47+
## View
48+
49+
To see the logs or metrics, go to your project dashboard
3250

3351
![logs](docs/logs.png)
3452
![delta](docs/delta.png)
3553

36-
# Configuration
54+
## Configuration
3755

3856
| Parameter | Required | Default | Description |
3957
| --------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------ |
4058
| `apiKey` | no | - | Api key used to authorize against logdash servers. If you don't provide one, logs will be logged into local console only |
59+
| `host` | no | - | Custom API host, useful with self-hosted instances |
60+
| `verbose` | no | - | Useful for debugging purposes |
4161

42-
# License
62+
## License
4363

4464
This project is licensed under the MIT License.
4565

46-
# Contributing
66+
## Contributing
4767

4868
Contributions are welcome! Feel free to open issues or submit pull requests.
4969

50-
# Support
70+
## Support
5171

5272
If you encounter any issues, please open an issue on GitHub or let us know at [contact@logdash.io](mailto:contact@logdash.io).

0 commit comments

Comments
 (0)