17 lines
496 B
TypeScript
17 lines
496 B
TypeScript
type LogLevel = 'debug' | 'info' | 'warn' | 'error'
|
|
|
|
type LoggerPayload = Record<string, unknown> | undefined
|
|
|
|
type LoggerApi = {
|
|
debug: (message: string, payload?: LoggerPayload) => void
|
|
info: (message: string, payload?: LoggerPayload) => void
|
|
warn: (message: string, payload?: LoggerPayload) => void
|
|
error: (message: string, payload?: LoggerPayload) => void
|
|
}
|
|
|
|
export function useLogger(): LoggerApi {
|
|
return useNuxtApp().$logger
|
|
}
|
|
|
|
export type { LoggerApi, LoggerPayload, LogLevel }
|