-
Notifications
You must be signed in to change notification settings - Fork 4
Logging
Hangman edited this page Sep 6, 2022
·
2 revisions
TuningFork is able to log various errors and events. By default, it logs through Gdx.
TuningForkLogger logger = new YourLogger();
AudioConfig config = new AudioConfig();
config.setLogger(logger);
audio = Audio.init(config);
- GdxLogger
This is the default one that logs through libGDX. - ConsoleLogger
This one uses System.out and let's you set a LogLevel.
AudioConfig config = new AudioConfig();
config.setLogger(new ConsoleLogger(LogLevel.INFO_WARN_ERROR));
audio = Audio.init(config);
If you want to use a custom logger, you can implement the TuningForkLogger interface. It looks like this:
public interface TuningForkLogger {
void error(Class<?> clazz, String message);
void warn(Class<?> clazz, String message);
void info(Class<?> clazz, String message);
void debug(Class<?> clazz, String message);
void trace(Class<?> clazz, String message);
}
This way, it's also possible to build a bridge to other logging frameworks like log4j.
AudioConfig config = new AudioConfig();
config.setLogger(null);
audio = Audio.init(config);