@rawnodes/logger 2.8.0 → 2.9.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 +45 -4
- package/dist/index.d.mts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +66 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,16 +136,57 @@ This is useful for sending only critical errors to alerting systems while keepin
|
|
|
136
136
|
|
|
137
137
|
#### Level precedence
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
Each transport decides on its own whether to emit a given log entry. The precedence depends on whether the transport **respects runtime overrides** (see the next section):
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
**When respecting overrides** (observability transports — console/file/cloudwatch/relay by default):
|
|
142
|
+
|
|
143
|
+
1. **Runtime override** from `setLevelOverride(...)` or the top-level `level.rules` array
|
|
142
144
|
2. **Per-transport rule** (a matching entry in `console.rules` / `file.rules` / etc.)
|
|
143
145
|
3. **Per-transport level** (`console.level`, `file.level`, …)
|
|
144
146
|
4. **Global default level** (`level` or `level.default`)
|
|
145
147
|
|
|
146
|
-
|
|
148
|
+
**When ignoring overrides** (alert transports — discord/telegram/zohoCliq by default):
|
|
149
|
+
|
|
150
|
+
1. **Per-transport rule**
|
|
151
|
+
2. **Per-transport level**
|
|
152
|
+
3. **Global default level**
|
|
153
|
+
|
|
154
|
+
Practically: a matching `setLevelOverride({ userId: 123 }, 'debug')` will surface debug logs to **viewing** transports (console/cloudwatch/file), even if their own `level` is set to `info`. But the same override will **not** leak through notification channels (discord/telegram/zohoCliq) unless you explicitly opt them in via `respectRuntimeOverrides: true`.
|
|
155
|
+
|
|
156
|
+
#### Transport roles (`respectRuntimeOverrides`)
|
|
157
|
+
|
|
158
|
+
Every transport config accepts an optional `respectRuntimeOverrides?: boolean` flag. Defaults:
|
|
147
159
|
|
|
148
|
-
|
|
160
|
+
| Transport | Default | Role |
|
|
161
|
+
|--------------|---------|---------------|
|
|
162
|
+
| `console` | `true` | observability |
|
|
163
|
+
| `file` | `true` | observability |
|
|
164
|
+
| `cloudwatch` | `true` | observability |
|
|
165
|
+
| `relay` | `true` | observability |
|
|
166
|
+
| `discord` | `false` | alert |
|
|
167
|
+
| `telegram` | `false` | alert |
|
|
168
|
+
| `zohoCliq` | `false` | alert |
|
|
169
|
+
|
|
170
|
+
The defaults reflect typical usage — console/file/cloudwatch are where operators look for logs during troubleshooting, while discord/telegram/zohoCliq are user-facing notification channels that should not get flooded by ad-hoc debug overrides. Override the default per-transport when needed:
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
const logger = Logger.create({
|
|
174
|
+
level: 'info',
|
|
175
|
+
console: { format: 'plain' },
|
|
176
|
+
telegram: {
|
|
177
|
+
botToken: '...',
|
|
178
|
+
chatId: '...',
|
|
179
|
+
level: 'warn',
|
|
180
|
+
respectRuntimeOverrides: true, // let overrides through (rare)
|
|
181
|
+
},
|
|
182
|
+
cloudwatch: {
|
|
183
|
+
logGroupName: '...',
|
|
184
|
+
level: 'info',
|
|
185
|
+
respectRuntimeOverrides: false, // strict gate even under troubleshooting (also rare)
|
|
186
|
+
region: '...', accessKeyId: '...', secretAccessKey: '...',
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
```
|
|
149
190
|
|
|
150
191
|
### Per-Transport Rules
|
|
151
192
|
|
package/dist/index.d.mts
CHANGED
|
@@ -20,15 +20,34 @@ interface LevelRule {
|
|
|
20
20
|
};
|
|
21
21
|
level: LogLevel;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Controls whether a transport respects runtime level overrides registered via
|
|
25
|
+
* `setLevelOverride(...)` (or the top-level `level.rules` in the logger config).
|
|
26
|
+
*
|
|
27
|
+
* When `true` (the default for observability transports — console/file/cloudwatch/relay):
|
|
28
|
+
* a matching override bypasses the transport's own `level`/`rules` so that
|
|
29
|
+
* targeted troubleshooting actually surfaces logs in the viewing channels.
|
|
30
|
+
*
|
|
31
|
+
* When `false` (the default for alert-style transports — discord/telegram/zohoCliq):
|
|
32
|
+
* the transport filters strictly by its own `level`/`rules` and ignores runtime
|
|
33
|
+
* overrides, which prevents ad-hoc debug overrides from flooding user-facing
|
|
34
|
+
* notification channels.
|
|
35
|
+
*
|
|
36
|
+
* Every transport config accepts this flag; the only time it needs to be set
|
|
37
|
+
* explicitly is when overriding the default for the transport kind.
|
|
38
|
+
*/
|
|
39
|
+
type RespectRuntimeOverrides = boolean;
|
|
23
40
|
interface ConsoleConfig {
|
|
24
41
|
format: LogFormat;
|
|
25
42
|
level?: LogLevel;
|
|
26
43
|
rules?: LevelRule[];
|
|
44
|
+
respectRuntimeOverrides?: RespectRuntimeOverrides;
|
|
27
45
|
}
|
|
28
46
|
interface FileConfig {
|
|
29
47
|
format: LogFormat;
|
|
30
48
|
level?: LogLevel;
|
|
31
49
|
rules?: LevelRule[];
|
|
50
|
+
respectRuntimeOverrides?: RespectRuntimeOverrides;
|
|
32
51
|
dirname: string;
|
|
33
52
|
filename: string;
|
|
34
53
|
datePattern?: string;
|
|
@@ -40,6 +59,7 @@ interface FileConfig {
|
|
|
40
59
|
interface HttpTransportBaseConfig {
|
|
41
60
|
level?: LogLevel;
|
|
42
61
|
rules?: LevelRule[];
|
|
62
|
+
respectRuntimeOverrides?: RespectRuntimeOverrides;
|
|
43
63
|
batchSize?: number;
|
|
44
64
|
flushInterval?: number;
|
|
45
65
|
maxRetries?: number;
|
|
@@ -155,6 +175,8 @@ interface RelayConfig {
|
|
|
155
175
|
reconnectDelay?: number;
|
|
156
176
|
/** Max reconnect delay in ms (default: 30000) */
|
|
157
177
|
maxReconnectDelay?: number;
|
|
178
|
+
/** See RespectRuntimeOverrides. Default: true (relay is an observability transport). */
|
|
179
|
+
respectRuntimeOverrides?: RespectRuntimeOverrides;
|
|
158
180
|
}
|
|
159
181
|
interface CloudWatchConfig extends HttpTransportBaseConfig {
|
|
160
182
|
logGroupName: string;
|
|
@@ -580,6 +602,7 @@ declare const CloudWatchConfigSchema: z.ZodType<CloudWatchConfig>;
|
|
|
580
602
|
declare const ZohoCliqConfigSchema: z.ZodObject<{
|
|
581
603
|
level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
|
|
582
604
|
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
605
|
+
respectRuntimeOverrides: z.ZodOptional<z.ZodBoolean>;
|
|
583
606
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
584
607
|
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
585
608
|
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
@@ -620,6 +643,7 @@ declare const LoggerConfigSchema: z.ZodObject<{
|
|
|
620
643
|
zohoCliq: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
621
644
|
level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
|
|
622
645
|
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
646
|
+
respectRuntimeOverrides: z.ZodOptional<z.ZodBoolean>;
|
|
623
647
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
624
648
|
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
625
649
|
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
@@ -647,6 +671,7 @@ declare const LoggerConfigSchema: z.ZodObject<{
|
|
|
647
671
|
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
648
672
|
level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
|
|
649
673
|
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
674
|
+
respectRuntimeOverrides: z.ZodOptional<z.ZodBoolean>;
|
|
650
675
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
651
676
|
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
652
677
|
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
@@ -691,6 +716,7 @@ declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
|
|
|
691
716
|
apiKey: string;
|
|
692
717
|
level?: "off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
|
|
693
718
|
rules?: LevelRule[] | undefined;
|
|
719
|
+
respectRuntimeOverrides?: boolean | undefined;
|
|
694
720
|
batchSize?: number | undefined;
|
|
695
721
|
flushInterval?: number | undefined;
|
|
696
722
|
maxRetries?: number | undefined;
|
|
@@ -715,6 +741,7 @@ declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
|
|
|
715
741
|
apiKey: string;
|
|
716
742
|
level?: "off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
|
|
717
743
|
rules?: LevelRule[] | undefined;
|
|
744
|
+
respectRuntimeOverrides?: boolean | undefined;
|
|
718
745
|
batchSize?: number | undefined;
|
|
719
746
|
flushInterval?: number | undefined;
|
|
720
747
|
maxRetries?: number | undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -20,15 +20,34 @@ interface LevelRule {
|
|
|
20
20
|
};
|
|
21
21
|
level: LogLevel;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Controls whether a transport respects runtime level overrides registered via
|
|
25
|
+
* `setLevelOverride(...)` (or the top-level `level.rules` in the logger config).
|
|
26
|
+
*
|
|
27
|
+
* When `true` (the default for observability transports — console/file/cloudwatch/relay):
|
|
28
|
+
* a matching override bypasses the transport's own `level`/`rules` so that
|
|
29
|
+
* targeted troubleshooting actually surfaces logs in the viewing channels.
|
|
30
|
+
*
|
|
31
|
+
* When `false` (the default for alert-style transports — discord/telegram/zohoCliq):
|
|
32
|
+
* the transport filters strictly by its own `level`/`rules` and ignores runtime
|
|
33
|
+
* overrides, which prevents ad-hoc debug overrides from flooding user-facing
|
|
34
|
+
* notification channels.
|
|
35
|
+
*
|
|
36
|
+
* Every transport config accepts this flag; the only time it needs to be set
|
|
37
|
+
* explicitly is when overriding the default for the transport kind.
|
|
38
|
+
*/
|
|
39
|
+
type RespectRuntimeOverrides = boolean;
|
|
23
40
|
interface ConsoleConfig {
|
|
24
41
|
format: LogFormat;
|
|
25
42
|
level?: LogLevel;
|
|
26
43
|
rules?: LevelRule[];
|
|
44
|
+
respectRuntimeOverrides?: RespectRuntimeOverrides;
|
|
27
45
|
}
|
|
28
46
|
interface FileConfig {
|
|
29
47
|
format: LogFormat;
|
|
30
48
|
level?: LogLevel;
|
|
31
49
|
rules?: LevelRule[];
|
|
50
|
+
respectRuntimeOverrides?: RespectRuntimeOverrides;
|
|
32
51
|
dirname: string;
|
|
33
52
|
filename: string;
|
|
34
53
|
datePattern?: string;
|
|
@@ -40,6 +59,7 @@ interface FileConfig {
|
|
|
40
59
|
interface HttpTransportBaseConfig {
|
|
41
60
|
level?: LogLevel;
|
|
42
61
|
rules?: LevelRule[];
|
|
62
|
+
respectRuntimeOverrides?: RespectRuntimeOverrides;
|
|
43
63
|
batchSize?: number;
|
|
44
64
|
flushInterval?: number;
|
|
45
65
|
maxRetries?: number;
|
|
@@ -155,6 +175,8 @@ interface RelayConfig {
|
|
|
155
175
|
reconnectDelay?: number;
|
|
156
176
|
/** Max reconnect delay in ms (default: 30000) */
|
|
157
177
|
maxReconnectDelay?: number;
|
|
178
|
+
/** See RespectRuntimeOverrides. Default: true (relay is an observability transport). */
|
|
179
|
+
respectRuntimeOverrides?: RespectRuntimeOverrides;
|
|
158
180
|
}
|
|
159
181
|
interface CloudWatchConfig extends HttpTransportBaseConfig {
|
|
160
182
|
logGroupName: string;
|
|
@@ -580,6 +602,7 @@ declare const CloudWatchConfigSchema: z.ZodType<CloudWatchConfig>;
|
|
|
580
602
|
declare const ZohoCliqConfigSchema: z.ZodObject<{
|
|
581
603
|
level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
|
|
582
604
|
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
605
|
+
respectRuntimeOverrides: z.ZodOptional<z.ZodBoolean>;
|
|
583
606
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
584
607
|
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
585
608
|
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
@@ -620,6 +643,7 @@ declare const LoggerConfigSchema: z.ZodObject<{
|
|
|
620
643
|
zohoCliq: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
621
644
|
level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
|
|
622
645
|
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
646
|
+
respectRuntimeOverrides: z.ZodOptional<z.ZodBoolean>;
|
|
623
647
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
624
648
|
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
625
649
|
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
@@ -647,6 +671,7 @@ declare const LoggerConfigSchema: z.ZodObject<{
|
|
|
647
671
|
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
648
672
|
level: z.ZodOptional<z.ZodType<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown, z.core.$ZodTypeInternals<"off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly", unknown>>>;
|
|
649
673
|
rules: z.ZodOptional<z.ZodArray<z.ZodType<LevelRule, unknown, z.core.$ZodTypeInternals<LevelRule, unknown>>>>;
|
|
674
|
+
respectRuntimeOverrides: z.ZodOptional<z.ZodBoolean>;
|
|
650
675
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
651
676
|
flushInterval: z.ZodOptional<z.ZodNumber>;
|
|
652
677
|
maxRetries: z.ZodOptional<z.ZodNumber>;
|
|
@@ -691,6 +716,7 @@ declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
|
|
|
691
716
|
apiKey: string;
|
|
692
717
|
level?: "off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
|
|
693
718
|
rules?: LevelRule[] | undefined;
|
|
719
|
+
respectRuntimeOverrides?: boolean | undefined;
|
|
694
720
|
batchSize?: number | undefined;
|
|
695
721
|
flushInterval?: number | undefined;
|
|
696
722
|
maxRetries?: number | undefined;
|
|
@@ -715,6 +741,7 @@ declare function safeValidateConfig(config: unknown): z.ZodSafeParseResult<{
|
|
|
715
741
|
apiKey: string;
|
|
716
742
|
level?: "off" | "error" | "warn" | "info" | "http" | "verbose" | "debug" | "silly" | undefined;
|
|
717
743
|
rules?: LevelRule[] | undefined;
|
|
744
|
+
respectRuntimeOverrides?: boolean | undefined;
|
|
718
745
|
batchSize?: number | undefined;
|
|
719
746
|
flushInterval?: number | undefined;
|
|
720
747
|
maxRetries?: number | undefined;
|
package/dist/index.js
CHANGED
|
@@ -789,13 +789,27 @@ function getLevelName(levelNum) {
|
|
|
789
789
|
if (levelNum >= 20) return "debug";
|
|
790
790
|
return "silly";
|
|
791
791
|
}
|
|
792
|
-
|
|
792
|
+
var DEFAULT_RESPECTS_OVERRIDES = {
|
|
793
|
+
console: true,
|
|
794
|
+
file: true,
|
|
795
|
+
cloudwatch: true,
|
|
796
|
+
relay: true,
|
|
797
|
+
discord: false,
|
|
798
|
+
telegram: false,
|
|
799
|
+
zohoCliq: false
|
|
800
|
+
};
|
|
801
|
+
function resolveRespectsOverrides(kind, configFlag) {
|
|
802
|
+
return configFlag ?? DEFAULT_RESPECTS_OVERRIDES[kind];
|
|
803
|
+
}
|
|
804
|
+
function shouldPassTransport(log, level, rules, state, respectOverrides) {
|
|
793
805
|
const logLevel = getLevelName(log.level);
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
if (embeddedOverride === "
|
|
797
|
-
|
|
798
|
-
|
|
806
|
+
if (respectOverrides) {
|
|
807
|
+
const embeddedOverride = log.__or;
|
|
808
|
+
if (typeof embeddedOverride === "string") {
|
|
809
|
+
if (embeddedOverride === "off") return false;
|
|
810
|
+
const overrideLevel = embeddedOverride;
|
|
811
|
+
return LOG_LEVELS[logLevel] <= LOG_LEVELS[overrideLevel];
|
|
812
|
+
}
|
|
799
813
|
}
|
|
800
814
|
const context = log.context;
|
|
801
815
|
if (rules && rules.length > 0) {
|
|
@@ -874,7 +888,7 @@ function formatLog(log, format, store) {
|
|
|
874
888
|
return `[${timestamp}] ${levelName}: ${message}
|
|
875
889
|
`;
|
|
876
890
|
}
|
|
877
|
-
function createFormattedFilterStream(format, level, rules, state, destination) {
|
|
891
|
+
function createFormattedFilterStream(format, level, rules, state, destination, respectOverrides) {
|
|
878
892
|
return new stream.Transform({
|
|
879
893
|
transform(chunk, _encoding, callback) {
|
|
880
894
|
const line = chunk.toString().trim();
|
|
@@ -887,7 +901,7 @@ function createFormattedFilterStream(format, level, rules, state, destination) {
|
|
|
887
901
|
callback();
|
|
888
902
|
return;
|
|
889
903
|
}
|
|
890
|
-
if (!shouldPassTransport(log, level, rules, state)) {
|
|
904
|
+
if (!shouldPassTransport(log, level, rules, state, respectOverrides)) {
|
|
891
905
|
callback();
|
|
892
906
|
return;
|
|
893
907
|
}
|
|
@@ -905,7 +919,8 @@ function createStreams(config, state) {
|
|
|
905
919
|
config.console.level,
|
|
906
920
|
config.console.rules,
|
|
907
921
|
state,
|
|
908
|
-
process.stdout
|
|
922
|
+
process.stdout,
|
|
923
|
+
resolveRespectsOverrides("console", config.console.respectRuntimeOverrides)
|
|
909
924
|
);
|
|
910
925
|
streams.push({
|
|
911
926
|
level: "trace",
|
|
@@ -938,7 +953,8 @@ function createStreams(config, state) {
|
|
|
938
953
|
fileConfig.level,
|
|
939
954
|
fileConfig.rules,
|
|
940
955
|
state,
|
|
941
|
-
rotatingStream
|
|
956
|
+
rotatingStream,
|
|
957
|
+
resolveRespectsOverrides("file", fileConfig.respectRuntimeOverrides)
|
|
942
958
|
);
|
|
943
959
|
streams.push({
|
|
944
960
|
level: "trace",
|
|
@@ -948,7 +964,13 @@ function createStreams(config, state) {
|
|
|
948
964
|
for (const discordConfig of toArray(config.discord)) {
|
|
949
965
|
const transport = new DiscordTransport(discordConfig);
|
|
950
966
|
transports.push(transport);
|
|
951
|
-
const discordStream = createHttpTransportStream(
|
|
967
|
+
const discordStream = createHttpTransportStream(
|
|
968
|
+
transport,
|
|
969
|
+
discordConfig.level,
|
|
970
|
+
discordConfig.rules,
|
|
971
|
+
state,
|
|
972
|
+
resolveRespectsOverrides("discord", discordConfig.respectRuntimeOverrides)
|
|
973
|
+
);
|
|
952
974
|
streams.push({
|
|
953
975
|
level: "trace",
|
|
954
976
|
stream: discordStream
|
|
@@ -957,7 +979,13 @@ function createStreams(config, state) {
|
|
|
957
979
|
for (const telegramConfig of toArray(config.telegram)) {
|
|
958
980
|
const transport = new TelegramTransport(telegramConfig);
|
|
959
981
|
transports.push(transport);
|
|
960
|
-
const telegramStream = createHttpTransportStream(
|
|
982
|
+
const telegramStream = createHttpTransportStream(
|
|
983
|
+
transport,
|
|
984
|
+
telegramConfig.level,
|
|
985
|
+
telegramConfig.rules,
|
|
986
|
+
state,
|
|
987
|
+
resolveRespectsOverrides("telegram", telegramConfig.respectRuntimeOverrides)
|
|
988
|
+
);
|
|
961
989
|
streams.push({
|
|
962
990
|
level: "trace",
|
|
963
991
|
stream: telegramStream
|
|
@@ -966,7 +994,13 @@ function createStreams(config, state) {
|
|
|
966
994
|
for (const zohoCliqConfig of toArray(config.zohoCliq)) {
|
|
967
995
|
const transport = new ZohoCliqTransport(zohoCliqConfig);
|
|
968
996
|
transports.push(transport);
|
|
969
|
-
const zohoStream = createHttpTransportStream(
|
|
997
|
+
const zohoStream = createHttpTransportStream(
|
|
998
|
+
transport,
|
|
999
|
+
zohoCliqConfig.level,
|
|
1000
|
+
zohoCliqConfig.rules,
|
|
1001
|
+
state,
|
|
1002
|
+
resolveRespectsOverrides("zohoCliq", zohoCliqConfig.respectRuntimeOverrides)
|
|
1003
|
+
);
|
|
970
1004
|
streams.push({
|
|
971
1005
|
level: "trace",
|
|
972
1006
|
stream: zohoStream
|
|
@@ -975,7 +1009,13 @@ function createStreams(config, state) {
|
|
|
975
1009
|
for (const cloudwatchConfig of toArray(config.cloudwatch)) {
|
|
976
1010
|
const transport = new CloudWatchTransport(cloudwatchConfig, config.hostname);
|
|
977
1011
|
transports.push(transport);
|
|
978
|
-
const cwStream = createHttpTransportStream(
|
|
1012
|
+
const cwStream = createHttpTransportStream(
|
|
1013
|
+
transport,
|
|
1014
|
+
cloudwatchConfig.level,
|
|
1015
|
+
cloudwatchConfig.rules,
|
|
1016
|
+
state,
|
|
1017
|
+
resolveRespectsOverrides("cloudwatch", cloudwatchConfig.respectRuntimeOverrides)
|
|
1018
|
+
);
|
|
979
1019
|
streams.push({
|
|
980
1020
|
level: "trace",
|
|
981
1021
|
stream: cwStream
|
|
@@ -1000,7 +1040,7 @@ function toArray(value) {
|
|
|
1000
1040
|
if (!value) return [];
|
|
1001
1041
|
return Array.isArray(value) ? value : [value];
|
|
1002
1042
|
}
|
|
1003
|
-
function createHttpTransportStream(transport, level, rules, state) {
|
|
1043
|
+
function createHttpTransportStream(transport, level, rules, state, respectOverrides) {
|
|
1004
1044
|
return new stream.Writable({
|
|
1005
1045
|
write(chunk, _encoding, callback) {
|
|
1006
1046
|
const line = chunk.toString().trim();
|
|
@@ -1013,7 +1053,7 @@ function createHttpTransportStream(transport, level, rules, state) {
|
|
|
1013
1053
|
callback();
|
|
1014
1054
|
return;
|
|
1015
1055
|
}
|
|
1016
|
-
if (!shouldPassTransport(log, level, rules, state)) {
|
|
1056
|
+
if (!shouldPassTransport(log, level, rules, state, respectOverrides)) {
|
|
1017
1057
|
callback();
|
|
1018
1058
|
return;
|
|
1019
1059
|
}
|
|
@@ -1172,12 +1212,14 @@ var LevelRuleSchema = zod.z.object({
|
|
|
1172
1212
|
var ConsoleConfigSchema = zod.z.object({
|
|
1173
1213
|
format: LogFormatSchema,
|
|
1174
1214
|
level: LogLevelSchema.optional(),
|
|
1175
|
-
rules: zod.z.array(LevelRuleSchema).optional()
|
|
1215
|
+
rules: zod.z.array(LevelRuleSchema).optional(),
|
|
1216
|
+
respectRuntimeOverrides: zod.z.boolean().optional()
|
|
1176
1217
|
});
|
|
1177
1218
|
var FileConfigSchema = zod.z.object({
|
|
1178
1219
|
format: LogFormatSchema,
|
|
1179
1220
|
level: LogLevelSchema.optional(),
|
|
1180
1221
|
rules: zod.z.array(LevelRuleSchema).optional(),
|
|
1222
|
+
respectRuntimeOverrides: zod.z.boolean().optional(),
|
|
1181
1223
|
dirname: zod.z.string().min(1, "dirname is required"),
|
|
1182
1224
|
filename: zod.z.string().min(1, "filename is required"),
|
|
1183
1225
|
datePattern: zod.z.string().optional(),
|
|
@@ -1189,6 +1231,7 @@ var FileConfigSchema = zod.z.object({
|
|
|
1189
1231
|
var HttpTransportBaseConfigSchema = zod.z.object({
|
|
1190
1232
|
level: LogLevelSchema.optional(),
|
|
1191
1233
|
rules: zod.z.array(LevelRuleSchema).optional(),
|
|
1234
|
+
respectRuntimeOverrides: zod.z.boolean().optional(),
|
|
1192
1235
|
batchSize: zod.z.number().int().positive().optional(),
|
|
1193
1236
|
flushInterval: zod.z.number().int().positive().optional(),
|
|
1194
1237
|
maxRetries: zod.z.number().int().nonnegative().optional(),
|
|
@@ -1202,6 +1245,7 @@ var HttpTransportBaseConfigSchema = zod.z.object({
|
|
|
1202
1245
|
var DiscordConfigSchema = zod.z.object({
|
|
1203
1246
|
level: LogLevelSchema.optional(),
|
|
1204
1247
|
rules: zod.z.array(LevelRuleSchema).optional(),
|
|
1248
|
+
respectRuntimeOverrides: zod.z.boolean().optional(),
|
|
1205
1249
|
batchSize: zod.z.number().int().positive().optional(),
|
|
1206
1250
|
flushInterval: zod.z.number().int().positive().optional(),
|
|
1207
1251
|
maxRetries: zod.z.number().int().nonnegative().optional(),
|
|
@@ -1223,6 +1267,7 @@ var DiscordConfigSchema = zod.z.object({
|
|
|
1223
1267
|
var TelegramConfigSchema = zod.z.object({
|
|
1224
1268
|
level: LogLevelSchema.optional(),
|
|
1225
1269
|
rules: zod.z.array(LevelRuleSchema).optional(),
|
|
1270
|
+
respectRuntimeOverrides: zod.z.boolean().optional(),
|
|
1226
1271
|
batchSize: zod.z.number().int().positive().optional(),
|
|
1227
1272
|
flushInterval: zod.z.number().int().positive().optional(),
|
|
1228
1273
|
maxRetries: zod.z.number().int().nonnegative().optional(),
|
|
@@ -1260,6 +1305,7 @@ var LogStreamNameSchema = zod.z.union([
|
|
|
1260
1305
|
var CloudWatchConfigSchema = zod.z.object({
|
|
1261
1306
|
level: LogLevelSchema.optional(),
|
|
1262
1307
|
rules: zod.z.array(LevelRuleSchema).optional(),
|
|
1308
|
+
respectRuntimeOverrides: zod.z.boolean().optional(),
|
|
1263
1309
|
batchSize: zod.z.number().int().positive().optional(),
|
|
1264
1310
|
flushInterval: zod.z.number().int().positive().optional(),
|
|
1265
1311
|
maxRetries: zod.z.number().int().nonnegative().optional(),
|
|
@@ -1280,6 +1326,7 @@ var CloudWatchConfigSchema = zod.z.object({
|
|
|
1280
1326
|
var ZohoCliqConfigBaseSchema = zod.z.object({
|
|
1281
1327
|
level: LogLevelSchema.optional(),
|
|
1282
1328
|
rules: zod.z.array(LevelRuleSchema).optional(),
|
|
1329
|
+
respectRuntimeOverrides: zod.z.boolean().optional(),
|
|
1283
1330
|
batchSize: zod.z.number().int().positive().optional(),
|
|
1284
1331
|
flushInterval: zod.z.number().int().positive().optional(),
|
|
1285
1332
|
maxRetries: zod.z.number().int().nonnegative().optional(),
|
|
@@ -1312,7 +1359,8 @@ var RelayConfigSchema = zod.z.object({
|
|
|
1312
1359
|
pollInterval: zod.z.number().int().positive().optional(),
|
|
1313
1360
|
bufferSize: zod.z.number().int().positive().optional(),
|
|
1314
1361
|
reconnectDelay: zod.z.number().int().positive().optional(),
|
|
1315
|
-
maxReconnectDelay: zod.z.number().int().positive().optional()
|
|
1362
|
+
maxReconnectDelay: zod.z.number().int().positive().optional(),
|
|
1363
|
+
respectRuntimeOverrides: zod.z.boolean().optional()
|
|
1316
1364
|
});
|
|
1317
1365
|
var LevelConfigObjectSchema = zod.z.object({
|
|
1318
1366
|
default: LogLevelSchema,
|