@scayle/storefront-nuxt
Version:
Nuxt integration for the SCAYLE Commerce Engine and Storefront API
21 lines (20 loc) • 917 B
TypeScript
import type { ConsolaInstance, ConsolaOptions } from 'consola';
import type { LogLevel } from '../index.js';
import { Log } from '@scayle/storefront-core';
/**
* Creates a Consola log instance.
*
* It creates a new log instance using the provided `createConsola` function.
* It sets up a handler that formats log entries with the `space` and logs them
* using the consola instance.
*
* @see https://github.com/unjs/consola?tab=readme-ov-file#creating-a-new-instance
*
* @param createConsola Function to create a consola instance.
* @param createConsola.options Options for the consola instance.
* @param space The space for the log. Defaults to 'default-storefront'.
* @param level The log level.
*
* @returns The created Consola log instance.
*/
export default function createLog(createConsola: (options?: Partial<ConsolaOptions>) => ConsolaInstance, space: string | undefined, level: LogLevel): Log;