Skip to content

LoggerOptions

Log configuration options type.

typescript
import type { LoggerOptions } from '@meng-xi/vite-plugin/logger'

Type Definition

typescript
interface LoggerOptions {
	/** Plugin name */
	name: string
	/** Whether to enable logging, default true */
	enabled?: boolean
}

Properties

name

Plugin name, used for log prefix identification.

TypeRequiredDescription
stringYesDisplayed in log prefix [@meng-xi/vite-plugin:name]
typescript
Logger.create({ name: 'my-plugin' })
// Output: ℹ️ [@meng-xi/vite-plugin:my-plugin] ...

enabled

Whether to enable logging.

TypeDefaultDescription
booleantrueWhen false, no logs are output for this plugin
typescript
// Disable logging
Logger.create({ name: 'my-plugin', enabled: false })

// Control by environment
Logger.create({ name: 'my-plugin', enabled: process.env.DEBUG === 'true' })

Released under the MIT License.