@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.
Files changed (2) hide show
  1. package/README.md +47 -5
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -4,11 +4,53 @@
4
4
  [![License](https://img.shields.io/npm/l/@hocuspocus/extension-logger.svg)](https://www.npmjs.com/package/@hocuspocus/extension-logger)
5
5
  [![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)
6
6
 
7
- ## Introduction
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
- ## Official Documentation
11
- Documentation can be found in the [GitHub repository](https://github.com/ueberdosis/hocuspocus).
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
- Hocuspocus is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/hocuspocus/blob/main/LICENSE.md).
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-rc.6",
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-rc.6"
32
+ "@hocuspocus/server": "^4.0.0"
33
33
  },
34
- "gitHead": "f8b039aea9d9c7f5b80b2cbb82381e2153ef8dc0",
34
+ "gitHead": "1c1b34800f702a06e1ce236e8a175c82876bff42",
35
35
  "repository": {
36
36
  "url": "https://github.com/ueberdosis/hocuspocus"
37
37
  },