@glassops/scribe 1.0.0 → 1.0.1
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 +15 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -85,9 +85,11 @@ const directory = createDirectory("/var/logs", {
|
|
|
85
85
|
environment: "production",
|
|
86
86
|
service: "billing",
|
|
87
87
|
});
|
|
88
|
+
```
|
|
88
89
|
|
|
90
|
+
### Creating a logger
|
|
89
91
|
|
|
90
|
-
|
|
92
|
+
```ts
|
|
91
93
|
import { createLogger } from "@glassops/scribe";
|
|
92
94
|
|
|
93
95
|
const logger = createLogger(directory, {
|
|
@@ -104,18 +106,22 @@ const logger = createLogger(directory, {
|
|
|
104
106
|
logToConsole: true,
|
|
105
107
|
sensitiveKeys: ["password", "token"],
|
|
106
108
|
});
|
|
109
|
+
```
|
|
107
110
|
|
|
111
|
+
## Logging methods
|
|
108
112
|
|
|
109
|
-
|
|
110
|
-
Logging methods
|
|
111
113
|
Each method accepts a message and optional context. Context is deeply redacted before writing.
|
|
112
|
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
114
|
+
|
|
115
|
+
- `logError(error, context?)`
|
|
116
|
+
- `logWarn(message, context?)`
|
|
117
|
+
- `logInfo(message, context?)`
|
|
118
|
+
- `logDebug(message, context?)`
|
|
119
|
+
- `logIncident(message, context?)`
|
|
120
|
+
- `logChange(message, context?)`
|
|
121
|
+
|
|
118
122
|
Example:
|
|
123
|
+
|
|
124
|
+
```ts
|
|
119
125
|
logger.logInfo("User updated profile", {
|
|
120
126
|
userId: "123",
|
|
121
127
|
password: "secret", // redacted
|