You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
10
+
11
+
To do a one-off build, use `npm run build` or `yarn build`.
12
+
13
+
To run tests, use `npm test` or `yarn test`.
14
+
15
+
## Configuration
16
+
17
+
Code quality will be set up using `prettier`, `husky`, and `lint-staged`.
18
+
19
+
### Jest
20
+
21
+
Jest tests are set up to run with `npm test` or `yarn test`.
22
+
23
+
### Rollup
24
+
25
+
This project uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
26
+
27
+
### TypeScript
28
+
29
+
`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `jsx`.
30
+
31
+
## Continuous Integration
32
+
33
+
### GitHub Actions
34
+
35
+
Two actions are added by default:
36
+
37
+
-`main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
38
+
39
+
## Optimizations
40
+
41
+
You can do development-only optimizations by using the `__DEV__` global variable.
42
+
43
+
```js
44
+
// ./types/index.d.ts
45
+
declare var__DEV__: boolean;
46
+
47
+
// inside your code...
48
+
if (__DEV__) {
49
+
console.log('foo');
50
+
}
51
+
```
52
+
53
+
## Module Formats
54
+
55
+
CJS, ESModules, and UMD module formats are supported.
56
+
57
+
The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
| emergency | Emergency | System is unusable | A panic condition.[[1]](https://pubs.opengroup.org/onlinepubs/009695399/functions/syslog.html)|
67
-
| alert | Alert | Action must be taken immediately | A condition that should be corrected immediately, such as a corrupted system database.[[1]](https://pubs.opengroup.org/onlinepubs/009695399/functions/syslog.html)|
| notice | Notice | Normal but significant conditions | Conditions that are not error conditions, but that may require special handling.[[1]](https://pubs.opengroup.org/onlinepubs/009695399/functions/syslog.html)|
72
-
| info | Informational | Informational messages ||
73
-
| debug | Debug | Debug-level messages | Messages that contain information normally of use only when debugging a program.[[1]](https://pubs.opengroup.org/onlinepubs/009695399/functions/syslog.html)|
74
-
75
-
## Commands
76
-
77
-
```bash
78
-
npm start # or yarn start
79
-
```
80
-
81
-
This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
82
-
83
-
To do a one-off build, use `npm run build` or `yarn build`.
| server | string | The endpoint to which the requests should be sent, including protocol. | yes |
65
+
| source | string | The client from which the logs are sent. | yes |
88
66
89
-
Code quality will be set up using `prettier`, `husky`, and `lint-staged`.
67
+
### Typescript
90
68
91
-
### Jest
69
+
If typescript is used, an optional type generic may be passed to the constructor. This can be used to type the extra information sent with each request (see the [Advanced Example](#advanced) for an example implementation), but is not required.
92
70
93
-
Jest tests are set up to run with `npm test` or `yarn test`.
94
-
95
-
### Rollup
96
-
97
-
This project uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
98
-
99
-
### TypeScript
100
-
101
-
`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `jsx`.
102
-
103
-
## Continuous Integration
104
-
105
-
### GitHub Actions
106
-
107
-
Two actions are added by default:
71
+
## Available methods
108
72
109
-
-`main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
73
+
The `GraylogClient` contains multiple convenience methods mapping directly towards syslog's [severity levels](https://en.wikipedia.org/wiki/Syslog#Severity_level).
| emergency | Emergency | System is unusable | A panic condition. [[1]](https://pubs.opengroup.org/onlinepubs/009695399/functions/syslog.html)|
78
+
| alert | Alert | Action must be taken immediately | A condition that should be corrected immediately, such as a corrupted system database. [[1]](https://pubs.opengroup.org/onlinepubs/009695399/functions/syslog.html)|
| notice | Notice | Normal but significant conditions | Conditions that are not error conditions, but that may require special handling. [[1]](https://pubs.opengroup.org/onlinepubs/009695399/functions/syslog.html)|
83
+
| info | Informational | Informational messages ||
84
+
| debug | Debug | Debug-level messages | Messages that contain information normally of use only when debugging a program. [[1]](https://pubs.opengroup.org/onlinepubs/009695399/functions/syslog.html)|
112
85
113
-
You can do development-only optimizations by using the `__DEV__` global variable.
86
+
Each method may be called with two parameters in accordance with the specification below.
| message | string | The short (summary) message to display in Graylog. | yes |
91
+
| extras | object | Any extra information, not including the source client. This object may be typed using a generic in the constructor, see [Constructor](#typescript). | no |
118
92
119
-
// inside your code...
120
-
if (__DEV__) {
121
-
console.log('foo');
122
-
}
123
-
```
93
+
## Contributing
124
94
125
-
## Module Formats
95
+
For guidelines and useful information, please see [CONTRIBUTING.md](https://github.com/Navigraph/graylog-client/blob/master/CONTRIBUTING.md)
126
96
127
-
CJS, ESModules, and UMD module formats are supported.
97
+
## License
128
98
129
-
The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
0 commit comments