File tree 1 file changed +9
-9
lines changed 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -47,24 +47,24 @@ This page explains how to use the @axiomhq/react library to send data from your
47
47
npm install --save @axiomhq/logging @axiomhq/react
48
48
```
49
49
50
- 1 . Add the following environment variables to your React app:
51
-
52
- - ` AXIOM_DATASET ` is the name of the Axiom dataset where you want to send data.
53
- - ` AXIOM_TOKEN ` is the Axiom API token you have generated.
54
-
55
- 1 . Create a ` Logger ` instance and export the utils. The example below uses the ` useLogger ` and ` WebVitals ` components.
50
+ 2 . Create a ` Logger ` instance and export the utils. The example below uses the ` useLogger ` and ` WebVitals ` components.
56
51
57
52
``` tsx [expandable]
58
53
' use client' ;
59
54
60
- import { Logger , AxiomFetchTransport } from ' @axiomhq/logging' ;
55
+ import { Logger , AxiomJSTransport } from ' @axiomhq/logging' ;
56
+ import { Axiom } from ' @axiomhq/js' ;
61
57
import { createUseLogger , createWebVitalsComponent } from ' @axiomhq/react' ;
62
58
59
+ const axiomClient = new Axiom ({
60
+ token: process .env .AXIOM_TOKEN ! ,
61
+ });
62
+
63
63
export const logger = new Logger ({
64
64
transports: [
65
- new AxiomFetchTransport ({
65
+ new AxiomJSTransport ({
66
+ client: axiomClient ,
66
67
dataset: process .env .AXIOM_DATASET ! ,
67
- token: process .env .AXIOM_TOKEN ! ,
68
68
}),
69
69
],
70
70
});
You can’t perform that action at this time.
0 commit comments