Logging

Action Logging

Log LevelPurposeDefault
infoLogs middleware and action handler registration infoEnabled
warnLogs warningsEnabled
errorLogs errors that occurs middleware and action handlersEnabled
debugLogs input context for every middleware and action handlersDisabled

Opt-in for specific logs

// --snip--
const router = new ActionRouter({
  // only logs `info` and `error` logs
  logging: [{ level: "error" }, { level: "info" }],
});

Opt-in conditionally

// --snip--
const router = new ActionRouter({
  logging: process.env.NODE_ENV === "production"
    ? [{ level: "error" }, { level: "info" }]
    : [
        { level: "error" },
        { level: "info" },
        { level: "warn" },
        { level: "debug" },
      ];
});

Disable

// --snip--
const router = new ActionRouter({
  logging: [], // pass in empty array
});