Reputation: 87
I'm using flutter_sound package for recording and playing audios. Default log level is pretty annoying.
I've tried
FlutterSoundRecorder myRecorder = FlutterSoundRecorder(logLevel: Level.debug);
but Level
is undefined here. It's not present in flutter_sound package (flutter_sound is already imported).
import 'package:flutter_sound/flutter_sound.dart';
I'm unable to figure out how to import it? Version of flutter_sound package is
flutter_sound: ^9.2.13
What am I doing wrong here?
Upvotes: 2
Views: 994
Reputation: 4531
First you'll have to add logger dependencies in pubspec:
logger: ^1.4.0
Then in code, you can individually disable/reduce logging:
player.setLogLevel(Level.error);
recorder.setLogLevel(Level.error);
Upvotes: 0
Reputation: 934
You can change the log level of the flutter_sound
package as follows:
First, you need to add the logging package to your project by command:
flutter pub add logger
Then, import the Level enum by adding the following import statement:
import 'package:logger/logger.dart';
Finally, set the log level to the intended value in your code:
final recorder = FlutterSoundRecorder(logLevel: Level.nothing);
final player = FlutterSoundPlayer(logLevel: Level.nothing);
Upvotes: 1
Reputation: 4769
As per flutter_sound doc, you can set loglevel as
await myRecorder.setLogLevel(Level.debug);
For detailed info, you can visit their documentation
Upvotes: 0