There are multiple ways of configuring the log level of the logger included in the various Twurple packages. Which one you should use depends entirely on your desired level of configuration granularity.
The logger used by Twurple supports configuration using an environment variable called LOGGING
.
Loggers are separated into namespaces separated with colons.
Using these namespaces, you can set different log levels for different types of logs.
It's probably easiest to show this by example:
LOGGING="default=error;twurple=debug;twurple:api:rate-limiter=critical"
This tells the logger the following things:
warning
.)(overrides the parent namespace setting and thus doesn't show debug messages).
All classes that log messages have support for a logger
option in the constructor,
in which you can also set a minimum log level to display:
const api = new ApiClient({
// ...
logger: {
minLevel: 'debug'
}
});
This setting always takes precedence over the environment variable settings.