@hocuspocus/extension-logger 4.0.0-rc.6 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -4,11 +4,53 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@hocuspocus/extension-logger)
|
|
5
5
|
[](https://github.com/sponsors/ueberdosis)
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
Logs connection, document, and lifecycle events for a [Hocuspocus](https://github.com/ueberdosis/hocuspocus) server to the console. Useful during development and debugging to see when clients connect, documents are loaded and stored, and changes come in.
|
|
7
|
+
Logs connection, document, and lifecycle events for a [Hocuspocus](https://github.com/ueberdosis/hocuspocus) server to the console. Useful during development and debugging to see when clients connect, documents load and store, and changes come in.
|
|
9
8
|
|
|
10
|
-
##
|
|
11
|
-
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @hocuspocus/extension-logger
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { Server } from "@hocuspocus/server"
|
|
19
|
+
import { Logger } from "@hocuspocus/extension-logger"
|
|
20
|
+
|
|
21
|
+
const server = new Server({
|
|
22
|
+
extensions: [new Logger()],
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
server.listen()
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Silence specific hooks
|
|
29
|
+
|
|
30
|
+
Pass booleans per hook to quiet down the ones you don't care about:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
new Logger({
|
|
34
|
+
onConnect: false,
|
|
35
|
+
onDisconnect: false,
|
|
36
|
+
onChange: false,
|
|
37
|
+
})
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Use a custom log function
|
|
41
|
+
|
|
42
|
+
Route output to your own logger (pino, winston, structured JSON, etc.):
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
new Logger({
|
|
46
|
+
log: (...args) => myLogger.info({ msg: args.join(" ") }),
|
|
47
|
+
})
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Documentation
|
|
51
|
+
|
|
52
|
+
Full options reference: [tiptap.dev/docs/hocuspocus/server/extensions/logger](https://tiptap.dev/docs/hocuspocus/server/extensions/logger).
|
|
12
53
|
|
|
13
54
|
## License
|
|
14
|
-
|
|
55
|
+
|
|
56
|
+
MIT — see [LICENSE.md](https://github.com/ueberdosis/hocuspocus/blob/main/LICENSE.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hocuspocus/extension-logger",
|
|
3
|
-
"version": "4.0.0
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "hocuspocus logging extension",
|
|
5
5
|
"homepage": "https://hocuspocus.dev",
|
|
6
6
|
"keywords": [
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@hocuspocus/server": "^4.0.0
|
|
32
|
+
"@hocuspocus/server": "^4.0.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "1c1b34800f702a06e1ce236e8a175c82876bff42",
|
|
35
35
|
"repository": {
|
|
36
36
|
"url": "https://github.com/ueberdosis/hocuspocus"
|
|
37
37
|
},
|