consola icon indicating copy to clipboard operation
consola copied to clipboard

Easier way to enable verbose log level

Open TurtleKwitty opened this issue 1 year ago • 3 comments

Environment

Consola: 3.2.3 Node: 21.6.1

Reproduction

call the .verbose("message") method of the logger

Describe the bug

No matter the log level I give to the ConsolaInstance logs called in from .verbose never reach my reporters. This method should either be removed if it's not intended to ever work or be fixed to pass the contents to reporters when the logger's level is set to 999 as expected.

Additional context

No response

Logs

No response

TurtleKwitty avatar Jul 31 '24 17:07 TurtleKwitty

Set level to LogLevels.verbose to enable verbose logs.

import { consola, LogLevels } from "consola"

consola.level = LogLevels.verbose

// or

createConsola({
  level: LogLevels.verbose,
  reporters: [ ... ]
})

(And the level for verbose is not 999, it's Number.POSITIVE_INFINITY)

https://github.com/unjs/consola/blob/main/src/constants.ts#L37

kricsleo avatar Mar 18 '25 09:03 kricsleo

@kricsleo i think we can set it to something like 10 to make setup easier. Feel free to drop a PR 👍🏼

pi0 avatar Mar 18 '25 09:03 pi0

The README.md states that +999 is for verbose logs, which is not true, it's Number.POSITIVE_INFINITY (as stated before above).

Is there a way to enable verbose logging using the CONSOLA_LEVEL env var right now? Passing CONSOLA_LEVEL=Infinity causes consola.level to become NaN. Setting it to 1000 has no effect.

Anoesj avatar Jun 27 '25 15:06 Anoesj