Vue Storefront is now Alokai! Learn More
Logger (deprecated)

Logger (deprecated)

This logger configuration is deprecated. Continuing to use it may result in the loss of features introduced with the new logger. Please refer to the documentation at https://docs.alokai.com/middleware/guides/logging for guidance on migrating to the new 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>;
}