Skip to main content

Logging

Nuxt Kit provides a set of utilities to help you work with logging. These functions allow you to log messages with extra features. Nuxt provides a logger instance that you can use to log messages with extra features.

useLogger

Returns a logger instance. It uses consola under the hood.

Type

Parameters

tag: A tag to suffix all log messages with, displayed on the right near the timestamp. options: Consola configuration options.

Usage

Example with options

Available log methods

The logger instance provides the following methods:
  • logger.info() - Log an info message
  • logger.success() - Log a success message
  • logger.warn() - Log a warning message
  • logger.error() - Log an error message
  • logger.debug() - Log a debug message
  • logger.trace() - Log a trace message
  • logger.log() - Log a generic message

Source

View source on GitHub