Vue Storefront is now Alokai! Learn More
Logger

Logger

SAP Commerce Cloud integration provides a logger that can be customized to fit your needs.

Good to know

Logger configuration is optional and can be skipped.

The logger must implement the Logger interface interface.

apps/storefront-middleware/config/sapcc.config.ts
export function getSapccConfig() {
  // ...
  return {
    location: "@vsf-enterprise/sapcc-api/server",
    configuration: {
      // ...
      logger: {
        debug: (message, ...args) => {
          // your implementation
          // eg.console.log(message, ...args);
        },
        error: (message, ...args) => {
          // your implementation
          // eg.console.log(message, ...args);
        },
        info: (message, ...args) => {
          // your implementation
          // eg.console.log(message, ...args);
        },
        success: (message, ...args) => {
          // your implementation
          // eg.console.log(message, ...args);
        },
      },
    },
  } satisfies Integration<MiddlewareConfig>;
}

You can disable the logger by setting the value to false. It will mute all logs.

apps/storefront-middleware/config/sapcc.config.ts
export function getSapccConfig() {
  // ...
  return {
    location: "@vsf-enterprise/sapcc-api/server",
    configuration: {
      // ...
      logger: false,
    },
  } satisfies Integration<MiddlewareConfig>;
}