alphacep / vosk-api

Offline speech recognition API for Android, iOS, Raspberry Pi and servers with Python, Java, C# and Node
Apache License 2.0
7.72k stars 1.08k forks source link

Misleading `vosk_set_log_level` documentation #1616

Open AlexCharlton opened 1 month ago

AlexCharlton commented 1 month ago

The verbosity of Kaldi's logging are governed by the value passed to SetVerboseLevel, which (to some degree) corresponds to the Severity enum [source]. The values are: -3 (assertion failed), -2 (error), -1 (warning), and 0 (info). Values greater than 0 are used for debug messages, but there does not seem to be any documentation for this.

The vosk_set_log_level docs state:

/** Set log level for Kaldi messages
 *
 *  @param log_level the level
 *     0 - default value to print info and error messages but no debug
 *     less than 0 - don't print info messages
 *     greater than 0 - more verbose mode
 */

It's explicit that this is just controlling Kaldi messages (true, given the implementation), but it does not mention that there are three levels below info. The -1 warn level would be good to call out as separate from the error level.

The Java LogLevel enum is similarly misleading, with no ability to restrict logging to just errors.

My suggestion for resolution: improve the documentation and add ERROR level to the Java enum.

This issue was first reported at the rust bindings project.

nshmyrev commented 1 month ago

We can change it a bit later, sure. Thanks for the report