@rawnodes/logger 2.7.0 → 2.7.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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -596,7 +596,13 @@ function shouldPassTransport(log, level, rules, store) {
|
|
|
596
596
|
const logLevel = getLevelName(log.level);
|
|
597
597
|
const context = log.context;
|
|
598
598
|
const storeContext = store.getStore();
|
|
599
|
-
const
|
|
599
|
+
const logMeta = {};
|
|
600
|
+
for (const [key, value] of Object.entries(log)) {
|
|
601
|
+
if (!["level", "time", "msg", "context"].includes(key)) {
|
|
602
|
+
logMeta[key] = value;
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
const matchingRule = rules?.find((rule) => matchesContext(storeContext, context, rule.match, logMeta));
|
|
600
606
|
const effectiveLevel = matchingRule?.level ?? level ?? "silly";
|
|
601
607
|
if (effectiveLevel === "off") return false;
|
|
602
608
|
return LOG_LEVELS[logLevel] <= LOG_LEVELS[effectiveLevel];
|
|
@@ -893,8 +899,8 @@ function getEffectiveLevel(state, loggerContext) {
|
|
|
893
899
|
}
|
|
894
900
|
return state.defaultLevel;
|
|
895
901
|
}
|
|
896
|
-
function matchesContext(storeContext, loggerContext, match) {
|
|
897
|
-
const combined = { ...storeContext, context: loggerContext };
|
|
902
|
+
function matchesContext(storeContext, loggerContext, match, logMeta) {
|
|
903
|
+
const combined = { ...logMeta, ...storeContext, context: loggerContext };
|
|
898
904
|
return Object.entries(match).every(([key, value]) => combined[key] === value);
|
|
899
905
|
}
|
|
900
906
|
var LogLevelSchema = z.enum([
|